Skip to content

bug: next-auth module completely broken with MODULE_NOT_FOUND next/server.js when doing folder structure instead of app #2033

Open
@marcomnrq

Description

@marcomnrq

Provide environment information

Happening in the latest version available: [email protected].

Describe the bug

On public and protected routes, the tRPC calls made from the client fail indicating the following error:
Screenshot 2024-11-24 at 7 30 42 PM

 Error: Failed to load external module next-auth: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/marcomnrq/VSCode Projects/examplebug/node_modules/next/server' imported from /Users/marcomnrq/VSCode Projects/examplebug/node_modules/next-auth/lib/env.js
Did you mean to import "next/server.js"?

Reproduction repo

n/a

To reproduce

Create a new app using the following settings.
Screenshot 2024-11-24 at 7 25 09 PM

Start the app with npm run dev and see the console / logs.

Additional information

Happy to help debugging this further, but i think it has to do with the import in this file. Will try to post some findings in this issue.
Screenshot 2024-11-24 at 7 32 33 PM

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions