Strange error when testing with Auth.js v5
Hi there,
I just created a fresh Next.js project and added
During integration tests when testing tRPC procedures that utilize
Error: Cannot find module '/path/to/project/node_modules/next/server' imported from /path/to/project/node_modules/next-auth/lib/env.js
Did you mean to import next/server.js?
vbnet
This error happens when mocking the tRPC session context through the use of
Here's the test that triggers the error:
The error is caused by the createInnerTRPCContext function.
Has anyone experienced a similar issue or could provide insights into how to navigate this problem?
I just created a fresh Next.js project and added
next-auth version 5 beta for authentication and tRPC for server logic. I have followed the setup documentation for both next-auth and tRPC.Setup Overview
- Next.js Version: 14.1.4
- next-auth Version: 5.0.0-beta.15
During integration tests when testing tRPC procedures that utilize
next-auth for session handling, I'm getting this weird error:Error: Cannot find module '/path/to/project/node_modules/next/server' imported from /path/to/project/node_modules/next-auth/lib/env.js
Did you mean to import next/server.js?
vbnet
This error happens when mocking the tRPC session context through the use of
createInnerTRPCContext.Test Example
Here's the test that triggers the error:
The error is caused by the createInnerTRPCContext function.
Has anyone experienced a similar issue or could provide insights into how to navigate this problem?