Skip to content

NextAuth v5 TypeError: next_dist_server_web_exports_next_request__WEBPACK_IMPORTED_MODULE_0__ is not a constructor #9922

@chungweileong94

Description

@chungweileong94

Environment

System:
    OS: macOS 14.3
    CPU: (8) arm64 Apple M2
    Memory: 2.59 GB / 16.00 GB
    Shell: 5.9 - /bin/zsh
Binaries:
    Node: 18.19.0 - ~/Library/Caches/fnm_multishells/18527_1707202116497/bin/node
    Yarn: 1.22.21 - ~/Library/Caches/fnm_multishells/18527_1707202116497/bin/yarn
    npm: 10.2.3 - ~/Library/Caches/fnm_multishells/18527_1707202116497/bin/npm
    pnpm: 8.14.1 - ~/Library/Caches/fnm_multishells/18527_1707202116497/bin/pnpm
    bun: 1.0.26 - /opt/homebrew/bin/bun
Browsers:
    Safari: 17.3
npmPackages:
    next: 14.0.4 => 14.0.4 
    next-auth: 5.0.0-beta.8 => 5.0.0-beta.8 
    react: ^18 => 18.2.0

Reproduction URL

https://github.com/chungweileong94/nextauth-route-handler-error

Describe the issue

If one of the AUTH_URL and NEXTAUTH_URL is set, we will get the following error.

TypeError: next_dist_server_web_exports_next_request__WEBPACK_IMPORTED_MODULE_0__ is not a constructor

How to reproduce

  1. Clone the repro
  2. Run the app via pnpm dev
  3. Navigate to http://localhost:3000/api/auth/signin

Expected behavior

It should show the next-auth built-in sign-in page. Instead, it shows throw 500 error (TypeError: next_dist_server_web_exports_next_request__WEBPACK_IMPORTED_MODULE_0__ is not a constructor)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingupstreamThe issue dervies from one of next-auth dependencies

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions