Viscision
Viscision4w ago

Auth Provider Discovery Failed

Has anyone recieved this error while self-hosting? I am using coolify to host convex and my front-end is a next.js app. Everything has been working with my app before when I was using convex cloud but I wanted to try self hosting instead and now I keep getting this error when trying to register/login/check if a user is authenticated. I obscured the url for security reasons. Any ideas would be great! Returning false from isAuthenticated because Error: {"code":"AuthProviderDiscoveryFailed","message":"Auth provider discovery of https://%2A%2A%2A%2A%2A/http failed: 404 Not Found
14 Replies
Convex Bot
Convex Bot4w 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!
erquhart
erquhart4w ago
Have you tried the auth debug steps? https://docs.convex.dev/auth/debug
Debugging Authentication | Convex Developer Hub
You have followed one of our authentication guides but something is not working.
Viscision
ViscisionOP3w ago
Yea nothing seems to work
Viscision
ViscisionOP3w ago
When I try to register an account or log in I do get these in the chrome console
No description
Viscision
ViscisionOP3w ago
Auth should be completely working as it was 100% working when I was using convex cloud idk if I am just missing something or a step with convex auth and self hosting but I followed the guide exactly This is my middleware.ts file for next.js
import {
convexAuthNextjsMiddleware,
createRouteMatcher,
nextjsMiddlewareRedirect,
} from "@convex-dev/auth/nextjs/server";

const isAuthPage = createRouteMatcher(["/auth(.*)"]);
const isProtectedRoute = createRouteMatcher(["/games(.*)", "/leaderboard(.*)"]);

export default convexAuthNextjsMiddleware(async (request, { convexAuth }) => {
if (isAuthPage(request) && (await convexAuth.isAuthenticated())) {
return nextjsMiddlewareRedirect(request, "/games");
}
if (isProtectedRoute(request) && !(await convexAuth.isAuthenticated())) {
return nextjsMiddlewareRedirect(request, "/");
}
});

export const config = {
// The following matcher runs middleware on all routes
// except static assets.
matcher: ["/((?!.*\\..*|_next).*)", "/", "/(api|trpc)(.*)"],
};
import {
convexAuthNextjsMiddleware,
createRouteMatcher,
nextjsMiddlewareRedirect,
} from "@convex-dev/auth/nextjs/server";

const isAuthPage = createRouteMatcher(["/auth(.*)"]);
const isProtectedRoute = createRouteMatcher(["/games(.*)", "/leaderboard(.*)"]);

export default convexAuthNextjsMiddleware(async (request, { convexAuth }) => {
if (isAuthPage(request) && (await convexAuth.isAuthenticated())) {
return nextjsMiddlewareRedirect(request, "/games");
}
if (isProtectedRoute(request) && !(await convexAuth.isAuthenticated())) {
return nextjsMiddlewareRedirect(request, "/");
}
});

export const config = {
// The following matcher runs middleware on all routes
// except static assets.
matcher: ["/((?!.*\\..*|_next).*)", "/", "/(api|trpc)(.*)"],
};
Viscision
ViscisionOP3w ago
And this shows up in my next.js npm run dev terminal after attempting to register/login
No description
erquhart
erquhart3w ago
Can you share the rest of the error in that last screenshot The beginning part has the actual error message
Viscision
ViscisionOP3w ago
It was too long had to upload as a txt file hope that is fine
Viscision
ViscisionOP3w ago
This maybe be helpful too so I will post it. On ly convex dashboard settings for URL & Deploy keys I have these so I created the CONVEX_SITE_URL environment variable matching that url and it seems that from that error message it is trying to hit that http actions url
No description
Viscision
ViscisionOP3w ago
And here is the authentication settins on my convex dashboard, this url matches the CONVEX_SITE_URL
No description
Viscision
ViscisionOP3w ago
I also tried manually opening this url and entering my admin token and it does says 404
No description
erquhart
erquhart3w ago
What domain is in your auth.config.ts? That's the Convex dashboard 404 html printed out in the error, which makes me think the auth domain is convex.dev or a subdomain of convex.dev. You can dm if you want to keep it private
Viscision
ViscisionOP3w ago
Okay thanks! I will send you a dm

Did you find this page helpful?