Skip to content

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

@abhi-codal

Description

@abhi-codal

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions