Comments (11)
I was facing the same issue, got solved by importing @prisma/client/edge instead of @prisma/client,
thanks @AbrahamX3 !!!
from prisma.
@iflamed If you are using D1, then you are not using Prisma Accelerate, which this issue is about - you are in the wrong place. Please open a new issue and describe your problem, then we can try to help. Thanks.
from prisma.
Hey, I noticed you're importing the PrismaClient
from @prisma/client
instead of @prisma/client/edge
, you should be using the edge import if you're deploying to Cloudflare Workers. This should make things work!
You can find this in their documentation: https://www.prisma.io/docs/accelerate/getting-started#24-extend-your-prisma-client-instance-with-the-accelerate-extension
from prisma.
@codewithharshjha Did you see the response from @AbrahamX3? Did this help?
from prisma.
I was facing the same issue, got solved by importing @prisma/client/edge instead of @prisma/client, thanks @AbrahamX3 !!!
This not works for me.
Got this error:
"PrismaClientValidationError: Prisma Client was configured to use the `adapter` option but it was imported via its `/edge` endpoint.\nPlease either remove the `/edge` endpoint or remove the `adapter` from the Prisma Client constructor."
from prisma.
Hey @iflamed, looking at the error message, if your Prisma client looks something like this:
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
Then it should look like the following, if you're using edge runtime and Prisma Accelerate (if your database doesn't support an edge runtime), here's how to get started with Prisma Accelerate https://www.prisma.io/docs/accelerate/getting-started
import { PrismaClient } from '@prisma/client'
import { withAccelerate } from '@prisma/extension-accelerate'
const prisma = new PrismaClient().$extends(withAccelerate())
If you're using a specific adapter, you can go to their documentation and see which ones are edge compatible https://www.prisma.io/docs/orm/prisma-client/deployment/edge/overview#which-database-drivers-are-edge-compatible
If you find one of your adapter/database in the list, you can then head over to https://www.prisma.io/docs/orm/overview/databases and pick your database for a more detailed documentation on how to set up your Prisma client.
from prisma.
Hey @iflamed, looking at the error message, if your Prisma client looks something like this:
import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient()Then it should look like the following, if you're using edge runtime and Prisma Accelerate (if your database doesn't support an edge runtime), here's how to get started with Prisma Accelerate https://www.prisma.io/docs/accelerate/getting-started
import { PrismaClient } from '@prisma/client' import { withAccelerate } from '@prisma/extension-accelerate' const prisma = new PrismaClient().$extends(withAccelerate())If you're using a specific adapter, you can go to their documentation and see which ones are edge compatible https://www.prisma.io/docs/orm/prisma-client/deployment/edge/overview#which-database-drivers-are-edge-compatible
If you find one of your adapter/database in the list, you can then head over to https://www.prisma.io/docs/orm/overview/databases and pick your database for a more detailed documentation on how to set up your Prisma client.
However, I have another problem, the PrismaClient
will result failed to deploy to cloudflare.
const adapter = new PrismaD1(c.env.DB)
prismaCli = new PrismaClient({ adapter })
from prisma.
@iflamed what error does it give you?
Also in your prisma/schema.prisma
, do you have the following configuration for generator client
?
generator client {
provider = "prisma-client-js"
previewFeatures = ["driverAdapters"]
}
from prisma.
@iflamed what error does it give you?
Also in your
prisma/schema.prisma
, do you have the following configuration forgenerator client
?generator client { provider = "prisma-client-js" previewFeatures = ["driverAdapters"] }
Yes, here is the schema.prisma
generator client {
provider = "prisma-client-js"
previewFeatures = ["driverAdapters"]
}
datasource db {
provider = "sqlite"
url = env("DATABASE_URL")
}
from prisma.
@iflamed Interesting, I have never used D1, so I'm not really sure how to fully deploy it, you can follow their documentation though https://developers.cloudflare.com/d1/tutorials/d1-and-prisma-orm/#what-is-prisma-orm
If you already have, maybe @janpio can further assist you but he's probably gonna need some more context on the error you get when deploying.
from prisma.
@AbrahamX3 @janpio Will you try this branch https://github.com/iflamed/hono-react-ssr-shadcn-ui/tree/prisma-debug, Follow these command below will deploy success in the cli, but failed on the cloudflare dashboard.
npm run install
npx prisma generate
npm run deploy
from prisma.
Related Issues (20)
- ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(PostgresError { code: "42P05", message: "prepared statement \"s0\" already exists", severity: "ERROR", detail: None, column: None, hint: None }), transient: false })]
- How to Perform Group By with Date Extraction in Prisma
- Unable to require libquery_engine-debian-openssl-3.0.x.so.node HOT 2
- Hello @bso-oo 👋 HOT 2
- Run Prisma on docker use elysia/Bun js HOT 1
- Inconsistent column data: Malformed ObjectID: provided hex string representation must be exactly 12 bytes, instead got HOT 2
- Support for manually managing prepared statements HOT 5
- Migration failed to apply cleanly to shadow database HOT 3
- VSCode Autocomplete Not Functioning When Extending Prisma Schema HOT 2
- Prisma Migrate Drops Custom Migrations HOT 5
- Types broken on void clients (no models) HOT 2
- RustPanic: RuntimeError HOT 1
- internal error: entered unreachable code HOT 1
- I'm using using prisma in auth.config.ts and Its giving vercel edge errors
- When using `pnpm` and deploying Prisma Client to Heroku, it fails at runtime with `Cannot find module '.prisma/client'` HOT 2
- Install fail! Error: [[email protected] › @prisma/[email protected]] Can't find package @prisma/engines's version: 5.14.0
- Error seeding DB via Prisma command, possible invocation error
- Bug: Migrations not compatible with D1 HOT 2
- Query optimization is not compatible with PostgreSQL citext fields HOT 2
- PrismaClientInitializationError HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prisma.