cps-user3
cps-user3
CCConvex Community
Created by cps-user3 on 6/4/2024 in #support-community
Null Response from ctx.auth.getUserIdentity() in Next.js API
Hello. I am using Auth0 to verify user authentication. I have created a Next.js app and a Flutter app using the same Auth0 domain, and I am fetching data for the Flutter app from the Next.js API. Could you please suggest a good way to use await ctx.auth.getUserIdentity()? Currently, the result is always null. convex/users.ts export const getUser = query({ handler: async (ctx) => { const identity = await ctx.auth.getUserIdentity(); return identity } }); api/users/route.ts export async function GET(req: NextRequest) { const user = await fetchQuery(api.users.getUser); return NextResponse.json(user); }
11 replies
CCConvex Community
Created by cps-user3 on 5/29/2024 in #support-community
How to call useQuery and useMutation in app/api/route.ts?
Hello. Is there a way to use queries and mutations in app/api/route.ts? I am creating an API with Next.js.
3 replies
CCConvex Community
Created by cps-user3 on 1/29/2024 in #support-community
How to update identity.name
Hello, I am creating a user table with the code below. export const create = mutation({ args: {}, handler: async (ctx, args) => { const identity = await ctx.auth.getUserIdentity(); if (!identity) { throw new Error("Not authenticated"); } const userId = identity.subject; const userName = identity.name; const user = await ctx.db.insert("users", { userId, userName, }); return user; } }); Is there a way to get a name from the client and update the identity.name with that value?
3 replies
CCConvex Community
Created by cps-user3 on 1/3/2024 in #support-community
Is there a way to modify the arguments of a schedule function?
export const getScheduledMessage = query({ args: { id: v.id("_scheduled_functions"), }, handler: async (ctx, args) => { return await ctx.db.system.get(args.id); }, }); I'd like to fetch the schedule, just like in the example document, and modify the arguments that are reserved. Is there any good way?
4 replies
CCConvex Community
Created by cps-user3 on 12/22/2023 in #support-community
How can I cancel scheduled?
export const cancelMessage = mutation({ args: { id: v.id("_scheduled_functions"), }, handler: async (ctx, args) => { await ctx.scheduler.cancel(args.id); }, }); Property 'cancel' does not exist on type 'Scheduler'. I followed the example in the documentation, but an error occurred. What's the cause?
6 replies