its only containing userId
Yes, that's as expected because that's the schema for a session object
I deleted your payload because it contained sensitive data
i needed email and name also which is associated with the gmail login
its not coming there
You can use the userId attribute and then fetch the user
using Accounts API right
Users since you're server side
Oops got it
Thanks
Will try this
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 ?
This is expected for now. We noticed bad performance sorted descending. We're working on it
Ok thanks.
Also cloud function is working fine now on google sign in as well using session create event. Thanks for the help
@Steven one issue is there i noticed like when i am signing in with google or creating account using signup with email and password
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
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 ?
How long is the delay?
max 15-25 seconds i believe
I'll have to check things on Monday
I ran it now again it toom around 30 seconds
took*
that's odd..it runs pretty quick for me. do you have other functions that process the same event?
code:
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:
{
"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": []
}
}