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.