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
- Timeout for hosting
- Urgent issue: Site Down!!
My site is down. i am not able to access Site using my custom domain, but site is accessible using appwrite domain link? can someone please help me with urgen...
- Adding records to DB with string [] and ...
when i enter records to the collection i do not see the records, but the app sees them. anyone can help me?