Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest canary breaks the @prisma/client module #30279

Closed
Floffah opened this issue Oct 25, 2021 · 6 comments · Fixed by #30286
Closed

Latest canary breaks the @prisma/client module #30279

Floffah opened this issue Oct 25, 2021 · 6 comments · Fixed by #30286
Labels
bug Issue was opened via the bug report template.

Comments

@Floffah
Copy link

Floffah commented Oct 25, 2021

What version of Next.js are you using?

11.1.3-canary.100

What version of Node.js are you using?

14.x (vercel lts)

What browser are you using?

Chrome

What operating system are you using?

Windows

How are you deploying your application?

Vercel

Describe the Bug

In the latest canary, api handlers get the error Error: Cannot find module '@prisma/client'.
I tested this using 11.1.3-canary.98 to 100 where the error occurs.
I also tested 11.1.3-canary.97 where theres no error. just as an extra case i tested in 11.1.2 and there is no error so its an issue with one >=11.1.3-canary.98 canary versions.

Expected Behavior

The @prisma/client module should be able to be found

To Reproduce

Create an api handler that references @prisma/client and try and send a request, should respond with 500 internal server error and the log drain should so the module error.

If needed i can provide my vercel deployment and access to the private repo where this issue occurs and i tested the 3 versions

Edit
I'm not completely sure if it is canary 98 that introduces the issue, I was going off of this as another of my websites uses the next-auth library as an api and it was on canary 97 and worked fine, on this i just tested 97 and it is also broken there however the only difference between this project using 97 and the other is that the file containing the prisma client instance is imported using src/lib/etc instead of ../../../lib/etc so it could be a module resolution thing similar to the old issue with apollo micro
i do know that it is a problem with 11.1.3 as i tested this using 11.1.2 on the library that had all 4 canary version broken instead of just the 3 and it worked fine on 11.1.2

yep confirmed this isnt an issue with 98 just canary as a whole as i ran require("@prisma/client") in the same file as the api handler
when i tested it using 11.1.2 it was definitely using the src/lib/etc path instead of ../../../ so its a module resolution issue with either swc or something introduced in canary

@Floffah Floffah added the bug Issue was opened via the bug report template. label Oct 25, 2021
@Floffah Floffah changed the title Prisma broken in canary Latest canary breaks the @prisma/client module Oct 25, 2021
@ijjk
Copy link
Member

ijjk commented Oct 25, 2021

Hi, can you share a repo with a minimal reproduction/a deployment with the error?

@Floffah
Copy link
Author

Floffah commented Oct 25, 2021

Hi, can you share a repo with a minimal reproduction/a deployment with the error?

I have made the repo public temporarily, here is the commit before I fixed it with the require
https://github.com/Floffah/timeline/commit/6ad4236af970c84595fcc9a8db2f1ee9cc229b98 and the file https://github.com/Floffah/timeline/blob/6ad4236af970c84595fcc9a8db2f1ee9cc229b98/src/pages/api/auth/%5B...nextauth%5D.ts
the deployment is in the comments of this commit, you should see the error if you press sign in after it loads for a while.

the project that uses canary 97 that doesnt need the require but uses relative imports instead of src/... imports is here https://github.com/Floffah/adiutor/blob/master/packages/web/src/pages/api/auth/%5B...nextauth%5D.ts where the sign in will take you to discord as expected

here is a screenshot of the error
image

@ijjk
Copy link
Member

ijjk commented Oct 25, 2021

Thanks for the reproduction I opened a PR with a fix for this case here #30286

@ijjk
Copy link
Member

ijjk commented Oct 26, 2021

The above fix is now available in v11.1.3-canary.102 of Next.js, please update and give it a try!

@Floffah
Copy link
Author

Floffah commented Oct 26, 2021

yep its working without the requires now, thank you!

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants