
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
- Selfhosting problem
I'm migrating from cloud to self-hosted. I tried using 'Export to self-hosted instance' and use my free Ngrok domain as Endpoint self-hosted instance, but I got...
- Direct Upgrade from Appwrite v1.5.11 to ...
I'm on Appwrite v1.5.11. Can I upgrade directly to v1.6.2?
- error code:524 for functions running lon...
We are having this issue, no longer the function runtime or code, if it goes longer than 1 minute, there's no logs at all, just this error: **error code: 524**
