users.*.update trigger function - inconsistent request payload
- 1
- Self Hosted
- Accounts
- Users
- Functions
I am experiencing an issue with the users.*.update trigger function. I've noticed that the payload data provided in the trigger event is inconsistent, particularly when different types of user information are updated.
When an email update occurs, the payload contains the full user object.
"x-appwrite-event": "users.656ae11125ca984676a9.update",
{
"$id": "656ae11125ca984676a9",
"$createdAt": "2023-12-02T07:47:29.156+00:00",
"$updatedAt": "2023-12-02T18:52:15.750+00:00",
"name": "",
"password": "$argon2id$v=19$m=65536,t=4,p=3$b0NuckhpMHVPRGtOWmFCUA$BG97mP3AIwRfjNS3NoaRqT+vS0e8ITsG8q8MLSY2zGk",
"hash": "argon2",
"hashOptions": {
"type": "argon2",
"memoryCost": 2048,
"timeCost": 4,
"threads": 3
},
"registration": "2023-12-02T07:47:29.155+00:00",
"status": true,
"labels": [],
"passwordUpdate": "2023-12-02T07:47:29.155+00:00",
"email": "admin123@test.com",
"phone": "",
"emailVerification": false,
"phoneVerification": false,
"prefs": {
"test": "value"
},
"accessedAt": "2023-12-02T07:47:29.155+00:00"
}
...
Conversely, when a user preference is updated, the payload only contains the preference object, not the full user object.
"x-appwrite-event": "users.656ae11125ca984676a9.update",
{
"body": {
"test": "value",
"test2": "val2"
},
...
}
This could be fine...but what's odd is it's different between the users API vs the account API. It would be good to create an issue for this
Not sure I follow correctly. There is no account.. event trigger for functions right? Both the above request payloads are for user.*.update event. Based on the docs the request payload should be a User object, can you please elaborate why the inconsistent payload could be fine here?
In the account API, there's a update preferences as well
Could be a bug...like I said, create an issue
Thanks for the clarification. Submitted an issue. https://github.com/appwrite/appwrite/issues/7234
hey @Drake Is there any problem with this PR?
I'll have to look again tomorrow
@Drake I am having difficulty understanding what changes I need to make. Could you please provide clarification?
What happened to my comment?! Arg..I added it again: https://github.com/appwrite/appwrite/pull/7264/files/f1ae25957f8439c1156860eadf3c441aec6b385e#r1428640839
done
all tests have passed. What should I do next?
@Drake The PR at https://github.com/appwrite/appwrite/pull/7264 is still not merged.
Yes, please give it some time
Recommended threads
- Appwrite not sending Emails
I’m running a self-hosted Appwrite instance (v1.8.1) and I can’t get invite emails to send when using the team invite flow described in the docs: https://appwri...
- Fulltext index creation fails due to Inn...
I'm running a self-hosted Appwrite 1.8.1 instance and encountering an issue when creating fulltext indexes on a collection. **The Problem:** Fulltext index cre...
- Function Building show 500 Error
Region: sfo Temple: Starter Function Runtime: Nodejs 22 What happened? Before 2 minutes it show ‘server error.","code":500,"version":"0.7.24"}’ after it show c...