11
112mo ago

Better-auth + convex 404

I integrated better auth with convex and exposed better-auth routes via httpRouter for api calls. Even through they are visible in convex functions dashboard, I'm still getting 404 and I do not understand what the issue is(Convex url in frontend is correct)
import { httpRouter } from "convex/server";
import { authComponent, createAuth } from "./auth";

const http = httpRouter();

authComponent.registerRoutes(http, createAuth, { cors: true });

export default http;
import { httpRouter } from "convex/server";
import { authComponent, createAuth } from "./auth";

const http = httpRouter();

authComponent.registerRoutes(http, createAuth, { cors: true });

export default http;
No description
2 Replies
11
11OP2mo ago
No description
erquhart
erquhart2mo ago
The request url should be hitting your site url (ends in convex.site) rather than your cloud url (ends in convex.cloud). You should have a baseURL set on either your authClient or your server Better Auth config (but not both) - that's likely where the incorrect url is being set. Also feel free to ask questions about this in #better-auth

Did you find this page helpful?