I’m experiencing a similar issue to the one discussed in this thread: Trying out v4 beta, receiving generic error
The key difference is that I’ve managed to get it working locally, but when I attempt to access “/auth/login” on either Vercel or my app domain, I receive a generic error message stating “An error occurred while trying to initiate the login request.”
My application is configured as a “Regular Web Application” with the following settings:
Allowed Callback URLs:
https://my.app/auth/callback,
https://my-app.vercel.app/auth/callback,
http://localhost:3000/auth/callback
Allowed Logout URLs:
https://my.app,
https://my-app.vercel.app/,
http://localhost:3000/
My environment variables are set as follows:
.env.local
AUTH0_DOMAIN='auth.my.app'
AUTH0_CLIENT_ID='...'
AUTH0_CLIENT_SECRET='...'
AUTH0_SECRET='...'
APP_BASE_URL='http://localhost:3000'
.env.production
AUTH0_DOMAIN='auth.my.app'
AUTH0_CLIENT_ID='...'
AUTH0_CLIENT_SECRET='...'
AUTH0_SECRET='...'
APP_BASE_URL='https://my.app'
As I mentioned earlier, this setup works seamlessly on my local machine, but throws an error when deployed to Vercel. The Vercel logs reveal the following error:
Hi: "response" is not a conform Authorization Server Metadata response (unexpected HTTP status code)
at (node_modules/.pnpm/oauth4webapi@3.1.3/node_modules/oauth4webapi/build/index.js:92:0)
at (node_modules/.pnpm/oauth4webapi@3.1.3/node_modules/oauth4webapi/build/index.js:221:0)
at (node_modules/.pnpm/@auth0+nextjs-auth0@4.0.0-beta.8_next@15.0.3_react-dom@18.3.1_react@18.3.1__react@18.3.1_sass_nalkpas7ifge363zka4f67ub7m/node_modules/@auth0/nextjs-auth0/dist/server/auth-client.js:369:36)
at (node_modules/.pnpm/@auth0+nextjs-auth0@4.0.0-beta.8_next@15.0.3_react-dom@18.3.1_react@18.3.1__react@18.3.1_sass_nalkpas7ifge363zka4f67ub7m/node_modules/@auth0/nextjs-auth0/dist/server/auth-client.js:365:0)
at (node_modules/.pnpm/@auth0+nextjs-auth0@4.0.0-beta.8_next@15.0.3_react-dom@18.3.1_react@18.3.1__react@18.3.1_sass_nalkpas7ifge363zka4f67ub7m/node_modules/@auth0/nextjs-auth0/dist/server/auth-client.js:92:0)
at (src/middleware.ts:6:9)
at (node_modules/.pnpm/next@15.0.3_react-dom@18.3.1_react@18.3.1__react@18.3.1_sass@1.81.0/node_modules/next/dist/esm/server/web/adapter.js:212:0)
at (node_modules/.pnpm/next@15.0.3_react-dom@18.3.1_react@18.3.1__react@18.3.1_sass@1.81.0/node_modules/next/dist/esm/server/web/adapter.js:163:0)
and, as @bryso mentioned, it would be really nice to have informative errors, or at least log traces, where we can see which url is requested and what response is receved