Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LoginHandlerError: Login handler failed. CAUSE: Page with dynamic = "error" couldn't be rendered statically because it used request.url. #133

Open
4 tasks done
abhi-codal opened this issue Sep 6, 2023 · 3 comments
Labels
question Further information is requested

Comments

@abhi-codal
Copy link

Checklist

  • I have looked into the Readme and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

Description

I have setup the auth0 for next.js as mentioned on the document. When I was trying to redirect user to /api/auth/login or any of the route mentioned in the document. It is giving me this error:

LoginHandlerError: Login handler failed. CAUSE: Page with `dynamic = "error"` couldn't be rendered statically because it used `request.url`.
    at eval (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/handlers/login.js:60:19)
    at eval (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/handlers/router-helpers.js:9:20)
    ... 27 lines matching cause stack trace ...
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'ERR_LOGIN_HANDLER_FAILURE',
  cause: StaticGenBailoutError: Page with `dynamic = "error"` couldn't be rendered statically because it used `request.url`.
      at Object.staticGenerationBailout (webpack-internal:///(rsc)/./node_modules/next/dist/client/components/static-generation-bailout.js:31:15)
      at handleReqBailout (webpack-internal:///(rsc)/./node_modules/next/dist/server/future/route-modules/app-route/helpers/proxy-request.js:93:23)
      at Object.get (webpack-internal:///(rsc)/./node_modules/next/dist/server/future/route-modules/app-route/helpers/proxy-request.js:101:13)
      at eval (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/handlers/login.js:54:37)
      at eval (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/handlers/router-helpers.js:9:20)
      at eval (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/handlers/auth.js:59:30)
      at eval (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/handlers/auth.js:35:24)
      at eval (webpack-internal:///(rsc)/./node_modules/next/dist/server/future/route-modules/app-route/module.js:254:43)
      at eval (webpack-internal:///(rsc)/./node_modules/next/dist/server/lib/trace/tracer.js:111:36)
      at NoopContextManager.with (webpack-internal:///(rsc)/./node_modules/next/dist/compiled/@opentelemetry/api/index.js:360:30)
      at ContextAPI.with (webpack-internal:///(rsc)/./node_modules/next/dist/compiled/@opentelemetry/api/index.js:30:58)
      at NoopTracer.startActiveSpan (webpack-internal:///(rsc)/./node_modules/next/dist/compiled/@opentelemetry/api/index.js:953:34)
      at ProxyTracer.startActiveSpan (webpack-internal:///(rsc)/./node_modules/next/dist/compiled/@opentelemetry/api/index.js:993:36)
      at eval (webpack-internal:///(rsc)/./node_modules/next/dist/server/lib/trace/tracer.js:100:107)
      at NoopContextManager.with (webpack-internal:///(rsc)/./node_modules/next/dist/compiled/@opentelemetry/api/index.js:360:30)
      at ContextAPI.with (webpack-internal:///(rsc)/./node_modules/next/dist/compiled/@opentelemetry/api/index.js:30:58)
      at NextTracerImpl.trace (webpack-internal:///(rsc)/./node_modules/next/dist/server/lib/trace/tracer.js:100:32)
      at eval (webpack-internal:///(rsc)/./node_modules/next/dist/server/future/route-modules/app-route/module.js:242:53)
      at AsyncLocalStorage.run (node:async_hooks:346:14)
      at Object.wrap (webpack-internal:///(rsc)/./node_modules/next/dist/server/async-storage/static-generation-async-storage-wrapper.js:42:24)
      at eval (webpack-internal:///(rsc)/./node_modules/next/dist/server/future/route-modules/app-route/module.js:196:97)
      at AsyncLocalStorage.run (node:async_hooks:346:14)
      at Object.wrap (webpack-internal:///(rsc)/./node_modules/next/dist/server/async-storage/request-async-storage-wrapper.js:82:24)
      at eval (webpack-internal:///(rsc)/./node_modules/next/dist/server/future/route-modules/app-route/module.js:195:75)
      at AsyncLocalStorage.run (node:async_hooks:346:14)
      at AppRouteRouteModule.execute (webpack-internal:///(rsc)/./node_modules/next/dist/server/future/route-modules/app-route/module.js:192:56)
      at AppRouteRouteModule.handle (webpack-internal:///(rsc)/./node_modules/next/dist/server/future/route-modules/app-route/module.js:315:41)
      at doRender (/Users/apatel1/Desktop/Projects/cost-plus/costplusdrugs-commerce/node_modules/next/dist/server/base-server.js:1091:56)
      at cacheEntry.responseCache.get.incrementalCache.incrementalCache (/Users/apatel1/Desktop/Projects/cost-plus/costplusdrugs-commerce/node_modules/next/dist/server/base-server.js:1290:46)
      at /Users/apatel1/Desktop/Projects/cost-plus/costplusdrugs-commerce/node_modules/next/dist/server/response-cache/index.js:99:42
      at ResponseCache.get (/Users/apatel1/Desktop/Projects/cost-plus/costplusdrugs-commerce/node_modules/next/dist/server/response-cache/index.js:149:11)
      at DevServer.renderToResponseWithComponentsImpl (/Users/apatel1/Desktop/Projects/cost-plus/costplusdrugs-commerce/node_modules/next/dist/server/base-server.js:1219:53)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
    code: 'NEXT_STATIC_GEN_BAILOUT'
  },
  status: undefined
}

Reproduction

I have just followed the steps provided in this documents: https://auth0.com/docs/quickstart/webapp/nextjs/01-login

Next.js version: 13.4.16

Additional context

No response

@adamjmcgrath
Copy link
Contributor

Hi @abhi-codal - thanks for raising this

I've not seen this error before and can't reproduce it on the sample app. Could you share a repo that demonstrates the issue and I'd be happy to debug it for you

@adamjmcgrath adamjmcgrath added the question Further information is requested label Sep 11, 2023
@mssxmt
Copy link

mssxmt commented Sep 17, 2023

i also have the same problem

StaticGenBailoutError: Page with dynamic = "error"couldn't be rendered statically because it usedrequest.url. at Object.staticGenerationBailout (webpack-internal:///(rsc)/./node_modules/next/dist/client/components/static-generation-bailout.js:31:15) at handleReqBailout (webpack-internal:///(rsc)/./node_modules/next/dist/server/future/route-modules/app-route/helpers/proxy-request.js:93:23) at Object.get (webpack-internal:///(rsc)/./node_modules/next/dist/server/future/route-modules/app-route/helpers/proxy-request.js:101:13) at login (webpack-internal:///(rsc)/./app/api/auth/[auth0]/route.ts:32:64) at eval (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/handlers/auth.js:59:30) at eval (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/handlers/auth.js:35:24) at eval (webpack-internal:///(rsc)/./node_modules/next/dist/server/future/route-modules/app-route/module.js:254:43) at eval (webpack-internal:///(rsc)/./node_modules/next/dist/server/lib/trace/tracer.js:111:36) at NoopContextManager.with (webpack-internal:///(rsc)/./node_modules/next/dist/compiled/@opentelemetry/api/index.js:360:30) at ContextAPI.with (webpack-internal:///(rsc)/./node_modules/next/dist/compiled/@opentelemetry/api/index.js:30:58) at NoopTracer.startActiveSpan (webpack-internal:///(rsc)/./node_modules/next/dist/compiled/@opentelemetry/api/index.js:953:34) at ProxyTracer.startActiveSpan (webpack-internal:///(rsc)/./node_modules/next/dist/compiled/@opentelemetry/api/index.js:993:36) at eval (webpack-internal:///(rsc)/./node_modules/next/dist/server/lib/trace/tracer.js:100:107) at NoopContextManager.with (webpack-internal:///(rsc)/./node_modules/next/dist/compiled/@opentelemetry/api/index.js:360:30) at ContextAPI.with (webpack-internal:///(rsc)/./node_modules/next/dist/compiled/@opentelemetry/api/index.js:30:58) at NextTracerImpl.trace (webpack-internal:///(rsc)/./node_modules/next/dist/server/lib/trace/tracer.js:100:32) at eval (webpack-internal:///(rsc)/./node_modules/next/dist/server/future/route-modules/app-route/module.js:242:53) at AsyncLocalStorage.run (node:async_hooks:338:14) at Object.wrap (webpack-internal:///(rsc)/./node_modules/next/dist/server/async-storage/static-generation-async-storage-wrapper.js:42:24) at eval (webpack-internal:///(rsc)/./node_modules/next/dist/server/future/route-modules/app-route/module.js:196:97) at AsyncLocalStorage.run (node:async_hooks:338:14) at Object.wrap (webpack-internal:///(rsc)/./node_modules/next/dist/server/async-storage/request-async-storage-wrapper.js:82:24) at eval (webpack-internal:///(rsc)/./node_modules/next/dist/server/future/route-modules/app-route/module.js:195:75) at AsyncLocalStorage.run (node:async_hooks:338:14) at AppRouteRouteModule.execute (webpack-internal:///(rsc)/./node_modules/next/dist/server/future/route-modules/app-route/module.js:192:56) at AppRouteRouteModule.handle (webpack-internal:///(rsc)/./node_modules/next/dist/server/future/route-modules/app-route/module.js:315:41) at doRender (/Users/masashiximoto/Documents/Reactproject/mssxmt-xlog/node_modules/next/dist/server/base-server.js:1091:56) at cacheEntry.responseCache.get.incrementalCache.incrementalCache (/Users/masashiximoto/Documents/Reactproject/mssxmt-xlog/node_modules/next/dist/server/base-server.js:1290:46) at /Users/masashiximoto/Documents/Reactproject/mssxmt-xlog/node_modules/next/dist/server/response-cache/index.js:99:42 at ResponseCache.get (/Users/masashiximoto/Documents/Reactproject/mssxmt-xlog/node_modules/next/dist/server/response-cache/index.js:149:11) at DevServer.renderToResponseWithComponentsImpl (/Users/masashiximoto/Documents/Reactproject/mssxmt-xlog/node_modules/next/dist/server/base-server.js:1219:53) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { code: 'NEXT_STATIC_GEN_BAILOUT' }

[email protected]

@jLynx
Copy link

jLynx commented Sep 27, 2023

Adding export const dynamic = "force-static" to the end of the routes.ts file will fix this issue. But will probably fail if you are using tauri. Apparently its to do with using a newer nextjs version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants