hi tema,
hi tema,
I am using clerk/backend and when i use
const response = await clerkClient.invitations.getInvitationList();
I am getting a convex error in the logs
"[Request ID: 8eeb178508e8f37a] Server Error
Uncaught Error: _Invitation {"id":"inv_2lYsQsr83hXeMCBdPO9uEt5nzgT","emailAddress":"ibrahim.s.amin@gmail.com","publicMetadata":{"type":"client"},"createdAt":1725368330622,"updatedAt":1725368330622,"status":"pending","revoked":"undefined"} is not a supported Convex type (present at path .data[0] in original object {"data":[{"id":"inv_2lYsQsr83hXeMCBdPO9uEt5nzgT","emailAddress":"ibrahim.s.amin@gmail.com","publicMetadata":{"type":"client"},"createdAt":1725368330622,"updatedAt":1725368330622,"status":"pending","revoked":"undefined"},{"id":"inv_2lYnM1xCtU0hagy9Lqw0Gsy5O9w","emailAddress":"ibrahim@marvelhomes.com.au","publicMetadata":{"type":"client"},"createdAt":1725365825401,"updatedAt":1725365883582,"status":"accepted","revoked":"undefined"}],"totalCount":2}). To learn about Convex's supported types, see https://docs.convex.dev/using/types."
yes when i use const response = await clerkClient.users.getUserList();
i dont get any errors.
the functions are working,
any advise would be much appreciated
p.s loving convex and how easy to use
Thanks20 Replies
Hi. It may be helpful if you can include more of the function.
My guess is that undefined is not a valid datatype which is noted here
https://docs.convex.dev/database/types (search undefined)
But it's merely a guess based on the error message - would need more information to validate. You could try unsetting the "revoked" column, or setting it to null.
Data Types | Convex Developer Hub
All Convex documents are defined as Javascript objects. These objects can have
Data types are only relevant when returning the value or trying to write it to the database - so based on the code snippet you gave so far, it's not clear where that would be happening.
this is the funciton. i am trying to get a list of all the results back so i can use it in my react front end
export const getInvitations = action({
handler: async () => {
const response = await clerkClient.invitations.getInvitationList();
const result = response;
console.log('INVITATIONS', response);
return result.data;
},
});
nice - what does the console.log look like?
'INVITATIONS' {
data: [
_Invitation {
id: 'inv_2lYsQsr83hXeMCBdPO9uEt5nzgT',
emailAddress: 'ibrahim.s.amin@gmail.com',
publicMetadata: [Object],
createdAt: 1725368330622,
updatedAt: 1725368330622,
status: 'pending',
revoked: undefined
},
_Invitation {
id: 'inv_2lYnM1xCtU0hagy9Lqw0Gsy5O9w',
emailAddress: 'ibrahim@marvelhomes.com.au',
publicMetadata: [Object],
createdAt: 1725365825401,
updatedAt: 1725365883582,
status: 'accepted',
revoked: undefined
}
],
totalCount: 2
}
and this is waht i get in convex dash


I bet
_Invitation
isn't a regular javascript object - has to be a javascript object in order to return it. That is annoying and nonobvious from the error though. I wonder if getInvitationList docs have infobtw, i am a noob and teaching myself how to program so i can build a tool for my business.. so i might have some fundamentals erros
this is the promess from getInvitationList()

nah - this is indeed something confusing happening.
btw, i added a retun response for this
export const getUsers = action({
handler: async () => {
const response = await clerkClient.users.getUserList();
console.log('USERS', response);
return response.data;
},
});
and now i get the same error
if i remove the return respose the error dispear
yeah - it's coming from Convex because convex has to get the return value from the server function -> client
I asked GPT and got some suggestions
so maybe something like
could be the key to being able to return what you want - as it converts it to an object
you can also just pull out the fields you care about into an object and just return that manually - and that will work
maybe becasue it has "" that is throwing an error with conves as my understanding the "" is reserved to convex system
GPT is pretty good - this probably will work

(this is the question I asked)

let me try it
thanks
yeah it fixed it
thanks heaps
its probably because Invitationis a class
right
GitHub
javascript/packages/backend/src/api/resources/Invitation.ts at f928...
Official Javascript repository for Clerk authentication - clerk/javascript