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

[5.9.0] Error: Prisma Client is unable to run in an edge runtime. As an alternative, try Accelerate: https://pris.ly/d/accelerate. #22893

Closed
mohe22 opened this issue Jan 31, 2024 · 17 comments · Fixed by #22880
Assignees
Labels
5.9.0 bug/0-unknown Bug is new, does not have information for reproduction or reproduction could not be confirmed. kind/regression A reported bug in functionality that used to work before. team/client Issue for team Client. topic: Next.js topic: next-auth / Auth.js
Milestone

Comments

@mohe22
Copy link

mohe22 commented Jan 31, 2024

I'm using Next Auth with next.js 14

Screenshot 2024-01-31 213240
Uploading Screenshot 2024-01-31 213307.png…

@Jolg42
Copy link
Member

Jolg42 commented Jan 31, 2024

(Note: This looks like a duplicate of #22886)

@mohe22 could you provide more details? What is your Prisma version? Do you get this error locally or on deployment? In the former case, are you using Node.js or other runtime? In the latter case, where are you deploying? Are you using any frameworks, bundlers, etc? It would be very helpful for us to resolve your problem if you could provide the information requested by the bug report template and a reproduction we can run.

Note that if you get this error when actually deploying to the edge, it is currently expected as Prisma Client support on the edge is currently a work in progress (#21394). However, given multiple issues opened about this today, I suspect the error might not be expected for you, and we'd appreciate it if you could help us provide the information necessary for us to help you.

@mohe22
Copy link
Author

mohe22 commented Jan 31, 2024

no I'm getting the error locally
"@prisma/client": "^5.9.0", "@auth/prisma-adapter": "^1.1.0",
and I'm using node v 18.18.0.

@Jolg42 Jolg42 added the 5.9.0 label Jan 31, 2024
@Jolg42
Copy link
Member

Jolg42 commented Jan 31, 2024

@mohe22 Could you try the following version 5.10.0-integration-fix-client-exports-map.11 and let us know if that fixes the issue?

(Note: related to #22880)

This will be part of the official 5.9.1 patch release soon.

@Jolg42 Jolg42 added bug/0-unknown Bug is new, does not have information for reproduction or reproduction could not be confirmed. kind/bug A reported bug. kind/regression A reported bug in functionality that used to work before. team/client Issue for team Client. labels Jan 31, 2024
@mohe22
Copy link
Author

mohe22 commented Jan 31, 2024

I changed the version "prisma": "^5.10.0-integration-fix-client-exports-map.11", however still have the issue

@Jolg42
Copy link
Member

Jolg42 commented Jan 31, 2024

@mohe22 Make sure to remove the caret ^ and put 5.10.0-integration-fix-client-exports-map.11 as the version and try again.

Note, you can do the following

  • update the version
  • npm install
  • npx prisma generate
  • Try what was not working before.

If there is still a problem after that, please provide a minimal reproduction, here is recent one as an example: https://github.com/darthmaim-reproductions/prisma-prisma-22877

@millsp millsp removed the kind/bug A reported bug. label Jan 31, 2024
@mohe22
Copy link
Author

mohe22 commented Jan 31, 2024

I solved the error by
1- "prisma": "^5.8.1",
2- and change import { PrismaClient } from "@prisma/client" to import { PrismaClient } from "@prisma/client/edge";
thank you.

@millsp
Copy link
Member

millsp commented Jan 31, 2024

Hey @mohe22 great to hear! That said, we shouldn't break anything really. Could you please try both @prisma/client and prisma with the version share by my colleague above? Thanks

@millsp millsp self-assigned this Jan 31, 2024
@mohe22
Copy link
Author

mohe22 commented Jan 31, 2024

I tried the above ones it did not work with me.
when i changed the versions to
"prisma": "^5.8.1",
"@prisma/client": "5.8.1",
it works without any errors

@Jolg42
Copy link
Member

Jolg42 commented Jan 31, 2024

@mohe22 It would help us if you can provide a minimal reproduction of your problem, like I mentioned earlier, here is recent one as an example: https://github.com/darthmaim-reproductions/prisma-prisma-22877

With that we would then try to reproduce on our side, and optimally we can see with that reproduction:

  • that everything works in 5.8.1
  • something breaks in 5.9.0
    And then, based on that, we can find a fix and confirm it.

Is that something you could send us today maybe?

@janpio janpio changed the title Error: Prisma Client is unable to run in an edge runtime. As an alternative, try Accelerate: https://pris.ly/d/accelerate. [5.9.0] Error: Prisma Client is unable to run in an edge runtime. As an alternative, try Accelerate: https://pris.ly/d/accelerate. Jan 31, 2024
@BernardinoOtais
Copy link

I tried the above ones it did not work with me. when i changed the versions to "prisma": "^5.8.1", "@prisma/client": "5.8.1", it works without any errors

Hi, I confirm that this works, had the same problem, so changed to 5.8.1, the issue is in version 5.9.0

@Jolg42
Copy link
Member

Jolg42 commented Feb 1, 2024

@BernardinoOtais So you are also using Next.js and Next Auth v5?

Could you set the version for Prisma packages to "5.9.1-dev.2" and try again, then let us know if that's fixed?

This would help to confirm that everything is fixed for our patch release planned later today.

@Jolg42 Jolg42 added this to the 5.10.0 milestone Feb 1, 2024
@BernardinoOtais
Copy link

@BernardinoOtais So you are also using Next.js and Next Auth v5?

Could you set the version for Prisma packages to "5.9.1-dev.2" and try again, then let us know if that's fixed?

This would help to confirm that everything is fixed for our patch release planned later today.

Hi Jolg42, did as you asked and it worked, what should I do for production?
Thans

@Jolg42
Copy link
Member

Jolg42 commented Feb 1, 2024

@BernardinoOtais Thanks! Then please wait for the official 5.9.1 patch release later today.
In the meantime, you can stay on the previous version 5.8.1

@BernardinoOtais
Copy link

Thanks @Jolg42

@pavelbe
Copy link

pavelbe commented Feb 1, 2024

Next.js Load Failure After Today's Prisma Update and Subsequent Database Interaction Issue After Applying Workaround 🚨🛠️

Today, I updated Prisma to the latest version in my Next.js application and faced a significant issue. Initially, the app failed to load, showing a browser error: "Error: Prisma Client is unable to run in an edge runtime. As an alternative, try Accelerate: https://pris.ly/d/accelerate. If this error is unexpected, please report it at https://github.com/prisma/prisma/issues/new."

Workaround Attempt:
After discovering the initial problem, I tried a workaround by changing the import statement from import { PrismaClient } from '@prisma/client' to import { PrismaClient } from '@prisma/client/edge'. This change allowed the application to load successfully in the browser. However, this led to a new issue when attempting to add a user to the database.

New Browser Error:

javascript
Copy code
Error: Invalid prisma.user.create() invocation:

Error validating datasource db: the URL must start with the protocol prisma://

Source
src\actions\register.ts (31:2) @ async register

29 | }
30 |

31 | await db.user.create({
| ^
32 | data: {
33 | email,
34 | name,
This error highlights a problem with the datasource URL format, specifically when invoking prisma.user.create(). It indicates that the URL must start with the protocol prisma://, which is an unexpected requirement and unclear how to resolve within the current setup.

Seeking Guidance:
I am looking for any assistance or guidance on how to address both the initial app loading issue post-update and the subsequent database interaction problem. Your support would be greatly appreciated 🙏. Thank you for your help!

@janpio
Copy link
Member

janpio commented Feb 1, 2024

No need to post the same message in multiple issues @pavelbe, I already replied to your message here: #22885 (comment)

@Jolg42
Copy link
Member

Jolg42 commented Feb 1, 2024

https://github.com/prisma/prisma/releases/tag/5.9.1 is now available with the fix ✨

Please create a new issue if you find a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.9.0 bug/0-unknown Bug is new, does not have information for reproduction or reproduction could not be confirmed. kind/regression A reported bug in functionality that used to work before. team/client Issue for team Client. topic: Next.js topic: next-auth / Auth.js
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants