
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
- Appwrite CLI can't create TABLE"
hello everyone, i'm trying to create tables via the cli but its not working, it keep saying `NO TABLEs FOUND`, here are my json structure **profile.json** ```{...
- HOw to downgrade from Appwrite Pro to Fr...
Hello everyone, please how do i downgrade from appwrite pro to free at the moment.
- import CSV file not working...
So I've tried to import this several times can anyone tell me what I'm doing wrong. This is just the Example on their blog: $id,title,author,year,available f3k9...
