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

publicMetadata does not update within the member list object, it is always empty. #1944

Open
4 tasks done
pavittarx opened this issue Oct 26, 2023 · 4 comments
Open
4 tasks done
Labels
prioritized This issue has been triaged and the team is working on it

Comments

@pavittarx
Copy link

Preliminary Checks

Reproduction / Replay Link

https://replit.com/@PavittarSingh1/ClerkBackendAPI-1

Publishable key

pk_test_aGVscGluZy1qYWd1YXItODguY2xlcmsuYWNjb3VudHMuZGV2JA

Description

Steps to reproduce:

  1. Update publicMetadata for any user.
  2. Fetch Individual user data, vs all the members of the organization.

Expected behavior:
the member within the organization member list should have their publicMetadata updated.

Actual behavior:

  • publicMetadata is updated and correct when fetching individual user data.
  • publicMetadata is empty in organizationMembersList

image

image

image

Environment

I tried it locally + on replit, so this is more of a problem w/ SDK. 
Let me know, if any more information is needed. 
Thanks!
@pavittarx pavittarx added the needs-triage A ticket that needs to be triaged by a team member label Oct 26, 2023
@pavittarx
Copy link
Author

You can quickly reproduce this by putting in your clerk secret key here, like this ...
image

@jescalan jescalan added the linear Created by Linear-GitHub Sync label Oct 30, 2023
@panteliselef
Copy link
Member

Hey @pavittarx, seems like you are expecting to read from a OrganizationMembership's publicMetadata but you are populating a User's publicMetadata

@pavittarx
Copy link
Author

Yes, the api I am using lists the info about the members of the organization, which are technically users. So, this should have, publicMetadata & privateMetadata of the user. And then, if you see it has an organization key which again has organization's public and private meta data. :)

image

@jescalan jescalan added prioritized This issue has been triaged and the team is working on it and removed needs-triage A ticket that needs to be triaged by a team member linear Created by Linear-GitHub Sync labels Nov 27, 2023
@ryan-saffer
Copy link

ryan-saffer commented Mar 26, 2024

Any update on this issue?

I have been told by the Clerk sales team that in order to avoid purchasing the 'Enhanced B2B SaaS add-on', which gives me custom roles and permissions, I can instead build it myself by storing a users role in their public metadata.

However the following two options do not work:

  1. Use the organization API to retrieve all members of the organisation, and view their public metadata. This does not work due to this issue, and the public metadata is always empty. (I have confirmed this in both the react and node SDKs).
  2. Use the users API to retrieve all users across all organisations, which does give me access to their public metadata, however the API does not include which organisations this user is a member of. This means I need to store the information of which organisations a user is a member of as part of their public metadata, something which is prone to many edge case errors, and the entire reason I have chosen Clerk is how organisations are a first class feature!

Edit:
Looking into the source code, this seems not to be an issue with the SDK but the API. I have confirmed this by using the Clerk API Reference and can see the public metadata coming through as empty.

How do I go about raising this as an issue with the core API?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
prioritized This issue has been triaged and the team is working on it
Projects
None yet
Development

No branches or pull requests

4 participants