
Good day, I am wondering how stable appwrite functions are. I am running the same function on every team creation and sometimes it creates everything fine, sometimes it does not execute properly. This function should execute every time a team is created.
This is the errors I get sometimes: Error: Server Error at Client.call (/usr/local/server/src/function/node_modules/node-appwrite/lib/client.js:172:31) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async Databases.createCollection (/usr/local/server/src/function/node_modules/node-appwrite/lib/services/databases.js:239:16) at async Module.default (file:///usr/local/server/src/function/src/main.js:117:33) at async execute (/usr/local/server/src/server.js:141:22) at async /usr/local/server/src/server.js:158:13
I got this in the logs once it is not an error but the function did not execute fully:
Unsupported logs detected. Use context.log() or context.error() for logging.
AppwriteException [Error]: Server Error at Client.call (/usr/local/server/src/function/node_modules/node-appwrite/lib/client.js:172:31) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async Databases.createBooleanAttribute (/usr/local/server/src/function/node_modules/node-appwrite/lib/services/databases.js:427:16) { code: 500, type: 'general_unknown', response: { message: 'Server Error', code: 500, type: 'general_unknown', version: '1.4.13' } }
the function code is in the attachment. I am just wondering why if works sometimes but does not sometimes, and I am not changing anything about how I am creating the team.
Thanks

The log error could be due to an unsupported format different from a string or an unhandled error.
The other error looks due to an incorrect attribute when creating a document

what is confusing is that it works sometimes.

So is it a problem with the way I structured the function?

And that has been my experience using appwrite functions. Sometimes a function does not work and I just try again and it works. So I am wondering if there is something I can do to stop this from happening. I am selfhosting my appwrite server, and some of these function executions are essential for my app, so if they do not run properly then that would be a mess. Last time it worked but did not create an attribute randomly.

How much time does it take for each function to run?

out of all the functions maxumum 1 second

and I have set timeout to 180 seconds

And does that happen when multiple functions are executed at the same time?

Also, I checked your code, and I recommend await in all the DB actions

Since that could be causing errors while sending all requests at the same time

Hey, are you logging anything?

I would also change your timeout to 15 seconds, because that's very long for a function.
Recommended threads
- appwrite cli alpine os
the appwrite cli does not work on alpine os if you install it using the recommended bash script. Maybe there is the possibility to compile it for alpine using t...
- Email OTP Mail Getting Delayed by 10 min...
I just noticed I am reciving delayed otp emails on frankfurt server we are on free plan now but we are planning to change to get on to paid plan can anyone plea...
- schedule functions not working
starting from 15:02 utc time my schedule function stops working. I was able to execute it using the GUI. The schedule is every 5 minutes and I can see a clock i...
