Back

Cloud Function User List Problem

  • 0
  • Functions
  • Cloud
Adam ONeill
27 Dec, 2024, 01:31

Hi,

I have a flutter x cloud solution. I have a cron job running every day to check for all users that have a free trial enables and checks the date of the expiration of their free trial. If 10 days passed they will have it removed.

  • The cron operates as expected
  • All variables are passed as expected
  • When running the user's endpoint (With the given api key) they are all returned from curl

I can't quite work out why userList is 0.

TL;DR
The developer is experiencing an issue where the userList is returning 0 despite confirmation of more than 0 users. The code involves a Flutter x Cloud solution with a cron job for free trial expiration. The cron job runs properly, variables pass as expected, and querying the user's endpoint directly returns all users. The problem lies in the userList fetching logic. Solution: Check for potential issues in the users.list function or ensure proper parameters are being passed for fetching the user list. Double-check API key permissions and data retrieval steps to troubleshoot the userList returning 0.
Adam ONeill
27 Dec, 2024, 01:32

Here is my code: its too long for discord!

Adam ONeill
27 Dec, 2024, 01:33

The problem is at

TypeScript
      const userList = await users.list(undefined, limit, offset);
      log(`Fetched ${userList.users.length} users in this batch.`);

Where it returns 0.

I can confirm there are more than 0 users

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