Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Bug Report: users.*.update trigger function - Inconsistent request payload #7234

Open
Irutom opened this issue Dec 3, 2023 · 7 comments · May be fixed by #7264
Open

🐛 Bug Report: users.*.update trigger function - Inconsistent request payload #7234

Irutom opened this issue Dec 3, 2023 · 7 comments · May be fixed by #7264
Assignees
Labels
bug Something isn't working good first issue Good for newcomers product / auth Fixes and upgrades for the Appwrite Auth / Users / Teams services.

Comments

@Irutom
Copy link

Irutom commented Dec 3, 2023

👟 Reproduction steps

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.

👍 Expected behavior

When an email update occurs, the payload contains the full user object.

 "x-appwrite-event": "users.656ae11125ca984676a9.update",
 {
  "body": {
      "$id": "656ae11125ca984676a9",
      "$createdAt": "2023-12-02T07:47:29.156+00:00",
      "$updatedAt": "2023-12-02T18:52:15.750+00:00",
      "name": "",
      "password": "..",
      "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": "[email protected]",
      "phone": "",
      "emailVerification": false,
      "phoneVerification": false,
      "prefs": {
          "test": "value"
      },
      "accessedAt": "2023-12-02T07:47:29.155+00:00"
  },
 }
...

👎 Actual Behavior

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"
    },
  ...
}

### 🎲 Appwrite version

Version 1.4.x

### 💻 Operating system

MacOS

### 🧱 Your Environment

Docker installation on mac. Function runtime node-18.0.

### 👀 Have you spent some time to check if this issue has been raised before?

- [X] I checked and didn't find similar issue

### 🏢 Have you read the Code of Conduct?

- [X] I have read the [Code of Conduct](https://github.com/appwrite/.github/blob/main/CODE_OF_CONDUCT.md)
@Irutom Irutom added the bug Something isn't working label Dec 3, 2023
@stnguyen90 stnguyen90 added the product / auth Fixes and upgrades for the Appwrite Auth / Users / Teams services. label Dec 3, 2023
@stnguyen90 stnguyen90 self-assigned this Dec 3, 2023
@stnguyen90
Copy link
Contributor

@urioanmot, thanks for creating this! Let me check with the team.

@stnguyen90
Copy link
Contributor

We'll want to update the users api to return the user object for consistency.

@stnguyen90 stnguyen90 added the good first issue Good for newcomers label Dec 5, 2023
@nick2432
Copy link

nick2432 commented Dec 5, 2023

can i work on this?

@stnguyen90
Copy link
Contributor

For now, we want to fix the users API to return the user object for consistency.

@nick2432 assigning to you now! Thanks for your patience!

@stnguyen90 stnguyen90 assigned nick2432 and unassigned stnguyen90 Dec 5, 2023
@Irutom
Copy link
Author

Irutom commented Dec 6, 2023

@nick2432 When a user preference is updated, the payload only contains the preference object, not the full user object as mentioned in the bug report.

@Irutom
Copy link
Author

Irutom commented Dec 8, 2023

@nick2432 It appears that the API call shown in the video is made from the dashboard UI to the server. If yes, that might not be the right place. Actual issue is with the request payload received on users.*.update event (cloud function), which needs to be consistent when updating user preferences vs other fields as mentioned in the bug description.

https://appwrite.io/docs/advanced/platform/events

image

@nick2432
Copy link

nick2432 commented Dec 8, 2023

@nick2432 It appears that the API call shown in the video is made from the dashboard UI to the server. If yes, that might not be the right place. Actual issue is with the request payload received on users.*.update event (cloud function), which needs to be consistent when updating user preferences vs other fields as mentioned in the bug description.

https://appwrite.io/docs/advanced/platform/events

image

ok

@nick2432 nick2432 linked a pull request Dec 10, 2023 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers product / auth Fixes and upgrades for the Appwrite Auth / Users / Teams services.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants