-
Notifications
You must be signed in to change notification settings - Fork 14
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
ERROR: Deploy to Cloudflare Pages after installing Prisma | Nuxt 3 #34
Comments
Same issue.. have you found a solution? |
@mtzrmzia yes, I found two solutions: 1. Switch to Drizzle (which I choose)😅I had to set the compatibility flag: and in nitro: {
rollupConfig: {
external: ["cloudflare:sockets"],
},
}, 2. Use Prisma Accelerate (which has a free plan)Here I used the prisma package and not the prisma nuxt module (I didn't try with the module) {
"dependencies": {
"@prisma/client": "5.18.0",
"@prisma/extension-accelerate": "^1.1.0",
"nuxt": "^3.12.4",
},
"devDependencies": {
"@prisma/client": "5.18.0",
"prisma": "5.18.0"
},
} your schmea: datasource db {
provider = "postgresql"
url = env("DATABASE_URL_ACCELERATE")
directUrl = env("DIRECT_URL")
} and your api for example import { PrismaClient } from "@prisma/client/edge";
import { withAccelerate } from "@prisma/extension-accelerate";
const prisma = new PrismaClient().$extends(withAccelerate());
export default defineEventHandler(async (event) => {
const users = await prisma.user.findMany({
select: {
id: true,
name: true,
},
cacheStrategy: { ttl: 60 },
});
return users;
}); 3. Cloudflare HyperdriveI think there is also a solution with it, by setting up a cloudflare worker which communicate with the DB and your app with the hyperdrive (exactly like prisma accelerate) - I tried but didn't succeed |
|
Bug description
I am trying to deploy a Nuxt 3 application to cloudflare, but after installing the prisma Module, the app stopped working
After running locally
npx nuxt build --preset cloudflare-pages ; npx wrangler pages dev dist/
I get this Error
In Cloudflare after deploying it I get this error:
and in the logs:
I tried with a local DB, one in Supabase and one in aiven (aws).
How to reproduce
Here is a reproduction repo: https://github.com/dalisys/prisma-flare.git
Expected behavior
Working
Prisma information
Schema
The text was updated successfully, but these errors were encountered: