Javascript Backend SDK response is empty for `getInvitationList`
Closed this issue · 4 comments
Preliminary Checks
-
I have reviewed the documentation: https://clerk.com/docs
-
I have searched for existing issues: https://github.com/clerk/javascript/issues
-
I have not already reached out to Clerk support via email or Discord (if you have, no need to open an issue here)
-
This issue is not a question, general help request, or anything other than a bug report directly related to Clerk. Please ask questions in our Discord community: https://clerk.com/discord.
Reproduction
https://replit.com/@PavittarSingh1/ClerkBackendAPI-1
Publishable key
pk_test_aGVscGluZy1qYWd1YXItODguY2xlcmsuYWNjb3VudHMuZGV2JA
Description
Steps to reproduce:
- Create an Organization
- Invite members from the UI Components.
- Try fetching the invitation list using
getInvitationList
Javascript Backend API. - The list is empty
Expected behavior:
The list should list at the very least the pending invitations.
Actual behavior:
Empty list is being returned. However the list of pending invitations shows up in the UI component.
Environment
System:
OS: Linux 6.5 Ubuntu 20.04.2 LTS (Focal Fossa)
CPU: (8) x64 AMD EPYC 7B13
Memory: 13.97 GB / 62.79 GB
Container: Yes
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 18.12.1 - /nix/store/dj805sw07vvpbxx39c8g67x8qddg0ikw-nodejs-18.12.1/bin/node
Yarn: 1.22.19 - /nix/store/zdcnqq55qi214j46zgw2qa1jp4dpdf2m-yarn-1.22.19/bin/yarn
npm: 8.19.2 - /nix/store/dj805sw07vvpbxx39c8g67x8qddg0ikw-nodejs-18.12.1/bin/npm
npmPackages:
@clerk/backend: ^1.2.4 => 1.2.4
@types/node: ^20.4.1 => 20.4.2
node-fetch: ^3.3.1 => 3.3.1
tsx: ^3.12.7 => 3.12.7
Hello @pavittarx and thank you for the report.
It's seems that there is an issue with the response of the endpoint or our documentation / backend API ref.
I will investigate it and provide feedback soon
After investigating the cause of your issue is that you are using the endpoint to retrieve instance invitations from the backend API, but you want to retrieve organization invitation.
This is not an issue in the API response, you need to use the current endpoint to retrieve the organization invitations.
curl -v -H "Authorization: Bearer {secretKey}" "https://api.clerk.com/v1/organizations/{orgID}/invitations?limit=10&offset=0"
or
// based on your screenshot
await clerk.organizations.getOrganizationInvitationList()
API ref: https://clerk.com/docs/reference/backend-api/tag/Organization-Invitations#operation/ListOrganizationInvitations
cc: @pavittarx
Closing this issue but feel free to open a new one if there is still an issue.