David AlonsoD
Convex Community6mo ago
2 replies
David Alonso

`AuthProviderDiscoveryFailed` when running `convex dev --local` with Convex Auth

We're using Convex Auth and have no issues with email OTP when using cloud dev deployments

However, when trying it against a local convex dev deployment, we run into these issues:

Returning false from isAuthenticated because Error: {"code":"AuthProviderDiscoveryFailed","message":"Auth provider discovery of http://127.0.0.1:3211 failed"}
    at async isAuthenticated (../../../src/nextjs/server/index.tsx:306:11)
    at async (website/middleware.ts:13:28)
    at async (../../../src/nextjs/server/index.tsx:227:8)
  11 |
  12 | export default convexAuthNextjsMiddleware(async (request, { convexAuth }) => {
> 13 |     const isAuthenticated = await convexAuth.isAuthenticated();
     |                            ^
  14 |
  15 |     // Handle root page routing with rewrite
  16 |     if (isRootPage(request)) { {
  
}



When hardcoding the following URL:
export default {
    providers: [
        {
            // domain: process.env.CONVEX_SITE_URL,
            domain: "https://localhost:3211",
            applicationID: "convex",
        },
    ],
};



Returning false from isAuthenticated because Error: {"code":"NoAuthProvider","message":"No auth provider found matching the given token. Check that your JWT's issuer and audience match one of your configured providers: [OIDC(domain=https://localhost:3211, app_id=convex)]"}
    at async isAuthenticated (../../../src/nextjs/server/index.tsx:306:11)
    at async (website/middleware.ts:13:28)
    at async (../../../src/nextjs/server/index.tsx:227:8)
  11 |
  12 | export default convexAuthNextjsMiddleware(async (request, { convexAuth }) => {
> 13 |     const isAuthenticated = await convexAuth.isAuthenticated();
     |                            ^
  14 |
  15 |     // Handle root page routing with rewrite
  16 |     if (isRootPage(request)) { {
  
}



What's the way to solve this?
Was this page helpful?