Back

How Stable Are Appwrite Functions

  • 0
  • Self Hosted
  • Functions
Asdshadow
30 Jan, 2024, 14:11

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

TL;DR
Developers are inquiring about the stability of Appwrite functions. They suggest changing the timeout to 15 seconds and recommend using 'await' in all database actions. They also mention potential issues with logging and recommend checking the log error for unsupported formats. The error in the logs indicates a server error, potentially due to an incorrect attribute when creating a document. The developers are unsure why the function works sometimes but not always, and are concerned about the reliability of their app. Solution: Review the code for any potential issues, especially related to attribute creation. Check the log errors and ensure compatibility with the supported logging formats. Consider adjusting the timeout
D5
30 Jan, 2024, 14:32

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

Asdshadow
30 Jan, 2024, 14:36

what is confusing is that it works sometimes.

Asdshadow
30 Jan, 2024, 14:37

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

Asdshadow
30 Jan, 2024, 14:43

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.

D5
30 Jan, 2024, 14:48

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

Asdshadow
30 Jan, 2024, 14:49

out of all the functions maxumum 1 second

Asdshadow
30 Jan, 2024, 14:49

and I have set timeout to 180 seconds

D5
30 Jan, 2024, 14:49

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

D5
30 Jan, 2024, 14:52

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

D5
30 Jan, 2024, 14:56

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

fafa
30 Jan, 2024, 14:58

Hey, are you logging anything?

fafa
30 Jan, 2024, 14:59

I would also change your timeout to 15 seconds, because that's very long for a function.

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more