You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Gagafeee opened this issue
Apr 22, 2025
· 1 comment
Labels
adaptersChanges related to the core code concerning database adaptersbugSomething isn't workingtriageUnseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
I try to implement unit tests in my application with node built-in test runner.
I use Next-Auth v4 with MongoDB adapter in Docker container.
I use the tsx module to execute my tests files **.test.ts.
But when I run tests with tsx --test, I get this weird error at the point where I import my MongoDBAdapter: Error: No "exports" main defined in /node_modules/@auth/mongodb-adapter/package.json.
I don't know much about npm module creation, but the package.json of the mogodb-adapter contains an extra "." object with export declaration:
Re-Run npm run test.
→ Test should pass and print MongoDBAdapter object in the console.
Expected behavior
The package should be exported in a way that tsx can read it, and no error should occur.
The text was updated successfully, but these errors were encountered:
Gagafeee
added
adapters
Changes related to the core code concerning database adapters
bug
Something isn't working
triage
Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
labels
Apr 22, 2025
adaptersChanges related to the core code concerning database adaptersbugSomething isn't workingtriageUnseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
Adapter type
@auth/mongodb-adapter
Environment
Standard Next.js project created with create-next-app.
I'm on
Windows
, I use Nodev22.2.0
locally, and I'm testing on Firefox.Reproduction URL
https://github.com/Gagafeee/next-auth-ERROR-reproduction-fork
Describe the issue
I try to implement unit tests in my application with node built-in test runner.
I use Next-Auth v4 with MongoDB adapter in Docker container.
I use the tsx module to execute my tests files
**.test.ts
.But when I run tests with
tsx --test
, I get this weird error at the point where I import myMongoDBAdapter
:Error: No "exports" main defined in /node_modules/@auth/mongodb-adapter/package.json
.I don't know much about npm module creation, but the
package.json
of the mogodb-adapter contains an extra"."
object with export declaration:And everything seems to work when I change it to (according to tsx documentation basic setup):
I wonder if it's a tsx bug or what is this
"."
object.Thanks in advance for help !
How to reproduce
npm install
.npm run dev
, the server should start correctly, and you should be able to navigate to the home page and to the login page.npm run test
.→ Test should fail with an
ERR_PACKAGE_PATH_NOT_EXPORTED
error.A Resolution try:
4. Go to
node_modules/@auth/mongodb-adapter/package.json
.5. Change
to
npm run test
.→ Test should pass and print MongoDBAdapter object in the console.
Expected behavior
The package should be exported in a way that tsx can read it, and no error should occur.
The text was updated successfully, but these errors were encountered: