nextauthjs / next-auth

Authentication for the Web.
https://authjs.dev
ISC License
24.18k stars 3.35k forks source link

@auth/sequelize-adapter - Cannot find module #7826

Closed Pab450 closed 1 year ago

Pab450 commented 1 year ago

Adapter type

@auth/sequelize-adapter

Environment

System: OS: macOS 12.6 CPU: (10) arm64 Apple M1 Pro Memory: 311.17 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 20.3.0 - /opt/homebrew/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 9.6.7 - /opt/homebrew/bin/npm Browsers: Chrome: 114.0.5735.133 Safari: 16.0

Reproduction URL

Client project. Using SvelteKit.

Update: https://github.com/Pab450/issue-sequelize-adapter

Describe the issue

when you run the "npm run dev" command and go to the project web page, the console returns :

[vite] Error when evaluating SSR module /src/hooks.server.js: failed to import "@auth/sequelize-adapter"

[ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/pablo/Documents/app/node_modules/@auth/sequelize-adapter/models' imported from /Users/pablo/Documents/app/node_modules/@auth/sequelize-adapter/index.js

when you run the "npm run build" command :

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/pablo/Documents/app/node_modules/@auth/sequelize-adapter/models' imported from /Users/pablo/Documents/app/node_modules/@auth/sequelize-adapter/index.js

How to reproduce

npm create svelte@latest my-app

Which Svelte app template? │ ● Skeleton project Add type checking with TypeScript? │ ● No Select additional option: │ ● Prettier

cd my-app

npm i

npm i @auth/sequelize-adapter

create file src/hooks.server.js

add this line : import SequelizeAdapter from '@auth/sequelize-adapter'

save

npm run dev

go to web page indicate by sveltekit

look the error in console

npm run build

look the error in console

Expected behavior

no error...

to fix it go to ./node_modules/@auth/sequelize-adapter/index.js

change first line :

import * as defaultModels from "./models";

to

import * as defaultModels from "./models.js";

the error disappears

pranatk commented 1 year ago

facing same issue

balazsorban44 commented 1 year ago

You can verify that the required files are present: https://www.npmjs.com/package/@auth/sequelize-adapter?activeTab=code

Cannot tell more without a reproduction.

github-actions[bot] commented 1 year ago

We cannot recreate the issue with the provided information. Please add a reproduction in order for us to be able to investigate.

Why was this issue marked with the incomplete label?

To be able to investigate, we need access to a reproduction to identify what triggered the issue. We prefer a link to a public GitHub repository (template), but you can also use a tool like CodeSandbox or StackBlitz.

To make sure the issue is resolved as quickly as possible, please make sure that the reproduction is as minimal as possible. This means that you should remove unnecessary code, files, and dependencies that do not contribute to the issue.

Please test your reproduction against the latest version of NextAuth.js (next-auth@latest) to make sure your issue has not already been fixed.

I added a link, why was it still marked?

Ensure the link is pointing to a codebase that is accessible (e.g. not a private repository). "example.com", "n/a", "will add later", etc. are not acceptable links -- we need to see a public codebase. See the above section for accepted links.

What happens if I don't provide a sufficient minimal reproduction?

Issues with the incomplete label that receives no meaningful activity (e.g. new comments with a reproduction link) are closed after 7 days.

If your issue has not been resolved in that time and it has been closed/locked, please open a new issue with the required reproduction. (It's less likely that we check back on already closed issues.)

I did not open this issue, but it is relevant to me, what can I do to help?

Anyone experiencing the same issue is welcome to provide a minimal reproduction following the above steps. Furthermore, you can upvote the issue using the :+1: reaction on the topmost comment (please do not comment "I have the same issue" without repro steps). Then, we can sort issues by votes to prioritize.

I think my reproduction is good enough, why aren't you looking into it quicker?

We look into every NextAuth.js issue and constantly monitor open issues for new comments.

However, sometimes we might miss one or two. We apologize, and kindly ask you to refrain from tagging core maintainers, as that will usually not result in increased priority.

Upvoting issues to show your interest will help us prioritize and address them as quickly as possible. That said, every issue is important to us, and if an issue gets closed by accident, we encourage you to open a new one linking to the old issue and we will look into it.

Useful Resources

Pab450 commented 1 year ago

You can verify that the required files are present: https://www.npmjs.com/package/@auth/sequelize-adapter?activeTab=code

Cannot tell more without a reproduction.

I don't understand what's non-reproducible about importing the package into a .js file and seeing the error displayed in the console!

but since that's the way it is, here's a repository where you can hopefully reproduce the error:

issue-sequelize-adapter

@pranatk can you try to clone the repo and try on your side to see if you still have the error?

EggerickxGillian commented 1 year ago

Hello,

I do have the same error while trying to run it. I have reproduced the same steps but still get the same error.

balazsorban44 commented 1 year ago

thanks @Pab450. please always assume that a reproduction is needed, no matter how "trivial" an issue might be. it will accelerate the resolving of any potential issue, as well as contributing to a healthy open source community where we mutually help each other 💚.

Your repro was awesome!

This should be fixed now, please upgrade the package! 🙏

Pab450 commented 1 year ago

I'm glad to hear that my reproduction was helpful in resolving the issue. I appreciate your efforts in addressing it promptly. Please let me know if there's anything else I can do to assist or contribute to the project. Thank you for all your hard work!