TheCyberverseT
Convex Community2y ago
37 replies
TheCyberverse

ctx.auth.getUserIdentity() returning undefined in webhook

hi, This doesn't work for me in the backend as I try to get the user identity in a webhook function, but it keeps returning null

here is the code:
export const webhookHandler = httpAction(async (ctx, request) => {
const body = await request.json();
const { target, installation } = body;

const userId = await getUserId(ctx);

if (userId === undefined) {
throw new ConvexError('User must be logged in.');
}
switch (target) {
case 'created':
await handleInstallationCreated(ctx, installation);
}

return new Response(Webhook Recieved, {
status: 200
});
});
error.png
Was this page helpful?