The function timeout is set to 900 seconds, but the function gives a 524 error after 1 minute (according to the dashboard UI). It is a cron scheduled function. I can't see the logs because it errors, so I don't even know how far it gets.
AFAIK 524 is a timeout error. What does the function do? If you call it directly does it work?
The counts the number of users in the db with the users endpoint. It has to do some cursor pagination because there are more than 5k
it gets triggered internally by the schedule cron
Sure, but can you execute it manually, and does it fail then too?
you mean manually using the appwrite dashboard UI?
Yes
it's now running
failed again:
Could you up the timeout period?
it is set to 900
Could you provide the function code?
i'm setting a counter to see if it exactly crashes after 60 sec.. i just ran it with less max pages and it run in 34 seconds normally.
So if you lower the amount you're fetching it works?
Maybe try increasing the limit so it has fewer http requests, and add a select query and select only the $id, so it reduces the payload.
log(`fetching page ${counter++}`)
const query = lastId ? [Query.limit(limit), Query.cursorAfter(lastId)] : [Query.limit(limit)]
const page = await users.list(query)
allUsers = allUsers.concat(page.users)
lastId = page.users.length > 0 ? page.users[page.users.length - 1].$id : undefined
} while (lastId && counter < 50)```
it actually runs past 1 minute if I increase the counter enough, so it doesn't seem like a timeout issue. But when I remove the counter it crashes with this vague error code: 524 and then it doesn't display any logs so it's a bit hard to debug the issue. Maybe it's something with the lastId check.
ow with 50 it actually crashes
It seems like it's an issue with slow queries, but I agree it is hard to know exactly what the issue is
anyway to see the actual output / error logs?
stacktraces?
Are you on cloud?
Yep
PS. the Query.select you suggested to select only the $id doesn't seem to work on the users.list method
AppwriteException: Invalid queries` param: Invalid query method: select
Recommended threads
- Function deployment failed: Unable to re...
Hi Appwrite team, I have been experiencing persistent errors when i attempt to push my appwrite functions. The logs on the deployment detail page on the console...
- One to many 2 way, console UI not correc...
Hey, seems I'm facing the exactly same issue with this one: https://github.com/appwrite/appwrite/issues/6016 Since this Github issue stay open for so long, let ...
- Server Down
Appwrite services are down. When will they start working again?