Back

Function is returning error 500 after some runs

  • 0
  • Functions
Drake
3 Oct, 2023, 21:03

Anything in the logs appwrite or executor logs?

TL;DR
The function is returning error 500 after some runs. The issue seems to be related to synchronous function execution timing out after 30 seconds. There may be DB maintenance going on that causes the timeout. The function fails sometimes, but not always, and there doesn't seem to be a specific pattern. One solution is to switch the function to async.
fernandoxlr
3 Oct, 2023, 21:03

The second screenshot is the execution log, only Errors tab is filled, I'm using appwrite cloud.

Drake
3 Oct, 2023, 21:03

Are all the execution errors the same?

fernandoxlr
3 Oct, 2023, 21:04

yes

fernandoxlr
3 Oct, 2023, 21:04

and almost all takes 8 seconds

fernandoxlr
3 Oct, 2023, 21:04

when it fails

fernandoxlr
3 Oct, 2023, 21:05

the code is very simple, I create few documents in a collection. After redeploy I can run the function with the same parameters that works normally.

Drake
3 Oct, 2023, 21:05

What's your project id?

fernandoxlr
3 Oct, 2023, 21:05

champz

fernandoxlr
3 Oct, 2023, 21:05

function id is createChatRooms

fernandoxlr
3 Oct, 2023, 21:09

actually, I create some collections (without documents) in a database.

Drake
3 Oct, 2023, 21:12

What's your code for that?

fernandoxlr
3 Oct, 2023, 21:16
fernandoxlr
3 Oct, 2023, 21:19

this execution id 651c72c1ebac85bd5f3d had received only 1 chat room to create. Like other executions. The maximum amount of chat rooms I sent to that function is 40. If I run now with 40, it works fine.

Drake
3 Oct, 2023, 21:59

any other info on timing? does always fail after an hour? or is it only certain times throughout the day?

fernandoxlr
3 Oct, 2023, 22:25

I doesn't seem to fail always after a specific time frame. I created this function today. So I will keep watching tomorrow if I can find a pattern.

Drake
4 Oct, 2023, 00:45

btw, createCollection() and the create attributes can stall and timeout if there is DB maintenance going on

fernandoxlr
4 Oct, 2023, 12:32

hmm, how db maintenance works?

fernandoxlr
4 Oct, 2023, 12:32

now it fails just some times.

fernandoxlr
4 Oct, 2023, 12:53

Yesterday, the function was always failing with 8s, and no group chats were created. Today the function is sometimes failing by timeout, but the chat groups are created.

fernandoxlr
4 Oct, 2023, 12:54

Hey, why is the server ignoring the timeout I put for that function? I set 60s

fernandoxlr
4 Oct, 2023, 12:56
Drake
4 Oct, 2023, 18:41

same time, every day for about an hour

Drake
4 Oct, 2023, 18:43

yes, there's been a change to synchronous function executions such that they will timeout after 30s

Drake
4 Oct, 2023, 18:43

you should probably switch it to async

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