BlueMelon
BlueMelon4d ago

[Self-hosted] HTTP actions 404 + JWT parsing error (Clerk)

[Self-hosted] HTTP actions 404 + JWT parsing error (Clerk) Hi all, I’m running Convex in a self-hosted setup (convex-local-backend binary, not Docker) with a Next.js + Clerk app, and I’m seeing two issues. Summary - Web app using ConvexProviderWithClerk works: ctx.auth.getUserIdentity() returns the user. - HTTP actions defined in convex/router.ts (e.g. /save, /links-list) always return 404. - Using ConvexHttpClient.setAuth(clerkJwt) from a Next.js API route causes a JWT parsing error on the backend. Environment - Convex: self-hosted convex-local-backend (version: 1.29.3) - Frontend: Next.js + TypeScript - Auth: Clerk with auth.config.ts: - domain: "https://clerk.usekalpa.com" - applicationID: "convex"
2 Replies
Convex Bot
Convex Bot4d ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
BlueMelon
BlueMelonOP4d ago
Details 1. HTTP actions 404 convex/router.ts contains routes like:
http.route({
path: "/save",
method: "POST",
handler: saveToKalpa,
});
http.route({
path: "/save",
method: "POST",
handler: saveToKalpa,
});
Calling https://<my-convex-host>/save (and similar paths like /links-list, /universes-list) returns 404. Backend logs:
WARN isolate::environment::analyze: Failed to resolve http.js:/save
WARN ... http.js:/links-list
WARN ... http.js:/universes-list
WARN isolate::environment::analyze: Failed to resolve http.js:/save
WARN ... http.js:/links-list
WARN ... http.js:/universes-list
2. JWT via ConvexHttpClient fails From a Next.js API route I do:
const convex = new ConvexHttpClient(process.env.NEXT_PUBLIC_CONVEX_URL!);
convex.setAuth(clerkJwt);
const result = await convex.query(api.links.getLinks, args);
const convex = new ConvexHttpClient(process.env.NEXT_PUBLIC_CONVEX_URL!);
convex.setAuth(clerkJwt);
const result = await convex.query(api.links.getLinks, args);
Backend log:
Could not parse JWT payload. Check that the token is a valid JWT format with three base64-encoded parts separated by dots.: Out of bounds
Could not parse JWT payload. Check that the token is a valid JWT format with three base64-encoded parts separated by dots.: Out of bounds
The same token looks valid on jwt.io and has iss/aud matching auth.config.ts Questions - Is there extra configuration needed for HTTP actions to be wired up correctly on self-hosted? - Is ConvexHttpClient.setAuth() expected to work with self-hosted + Clerk, or is this a known limitation/bug? - Any recommended next steps to debug this further on a self-hosted deployment? Thanks!

Did you find this page helpful?