Skip to content
Back

Cloud function Issue

  • 0
  • Users
  • Accounts
  • Web
yatharth
11 Jun, 2023, 04:25

its only containing userId

TL;DR
User is experiencing a delay in a cloud function. The delay ranges from 15-30 seconds. They are considering storing user information in a custom collection on the client side instead. The cloud function is running fine for Google sign-in using session create event. The support team acknowledges the delay and is working on improving performance. The user is also unable to access the user's email and name associated with Gmail login using the Accounts API.
Drake
11 Jun, 2023, 04:25

Yes, that's as expected because that's the schema for a session object

Drake
11 Jun, 2023, 04:25

I deleted your payload because it contained sensitive data

yatharth
11 Jun, 2023, 04:25

i needed email and name also which is associated with the gmail login

yatharth
11 Jun, 2023, 04:26

its not coming there

Drake
11 Jun, 2023, 04:27

You can use the userId attribute and then fetch the user

yatharth
11 Jun, 2023, 04:28

using Accounts API right

Drake
11 Jun, 2023, 04:38

Users since you're server side

yatharth
11 Jun, 2023, 04:39

Oops got it

yatharth
11 Jun, 2023, 04:39

Thanks

yatharth
11 Jun, 2023, 04:39

Will try this

yatharth
11 Jun, 2023, 04:42

Also I see in console functions deployment and executions both are sorted in wrong direction it should be descending order by latest created on first row. Is there any issue already ?

Drake
11 Jun, 2023, 04:44

This is expected for now. We noticed bad performance sorted descending. We're working on it

yatharth
11 Jun, 2023, 04:51

Ok thanks.

yatharth
11 Jun, 2023, 04:52

Also cloud function is working fine now on google sign in as well using session create event. Thanks for the help

yatharth
11 Jun, 2023, 05:11

@Steven one issue is there i noticed like when i am signing in with google or creating account using signup with email and password

yatharth
11 Jun, 2023, 05:11

cloud function is not running instantly and because of that in UI am not able to see user info as i am fetching it from custom collection for about 30-50 seconds

yatharth
11 Jun, 2023, 05:13

Maybe i will have to do all this in client side storing user in custom collection after user signup or login with google. What do you think ?

Drake
11 Jun, 2023, 05:15

How long is the delay?

yatharth
11 Jun, 2023, 05:15

max 15-25 seconds i believe

Drake
11 Jun, 2023, 05:17

I'll have to check things on Monday

yatharth
11 Jun, 2023, 05:17

I ran it now again it toom around 30 seconds

yatharth
11 Jun, 2023, 05:17

took*

Drake
13 Jun, 2023, 17:00

that's odd..it runs pretty quick for me. do you have other functions that process the same event?

Drake
13 Jun, 2023, 17:04

code:

TypeScript
module.exports = async function (req, res) {
  const data = JSON.parse(req.variables['APPWRITE_FUNCTION_EVENT_DATA'] ?? '{}');
  res.json({
    createdAt: data['$createdAt'],
    updatedAt: data['$updatedAt'],
    now: (new Date()).toISOString(),
    data: data
  });
};

output:

TypeScript
{
  "createdAt": "2023-06-13T17:03:17.466+00:00",
  "updatedAt": "2023-06-13T17:03:17.466+00:00",
  "now": "2023-06-13T17:03:17.540Z",
  "data": {
    "$id": "test",
    "$createdAt": "2023-06-13T17:03:17.466+00:00",
    "$updatedAt": "2023-06-13T17:03:17.466+00:00",
    "name": "Test",
    "password": "",
    "hash": "argon2",
    "hashOptions": { "memoryCost": 2048, "timeCost": 4, "threads": 3 },
    "registration": "2023-06-13T17:03:17.466+00:00",
    "status": true,
    "passwordUpdate": "",
    "email": "test@example.com",
    "phone": "",
    "emailVerification": false,
    "phoneVerification": false,
    "prefs": []
  }
}
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