worker error when using Building Nitro Server (preset: cloudflare_pages) and Prisma
adlab.pages.dev
build log is attached
the nitro server builds
14 Replies
The Function has some bad code in it
Since it's minified it's hard to know what. I'd suggest running locally to find out
wrangler pages dev <out dir>
that function is being generated from Building Nitro Server (preset: cloudflare_pages)
I'm aware
I'm just telling you the issue
thank you. let me see if i can get that page
the function is:
very basic
One of these things is undefined
Again, hard to know with minification
using https://nitro.unjs.io/deploy/providers/cloudflare#cloudflare-pages
would I be able to run the wrangler command locally and pass that preset?
looking in https://developers.cloudflare.com/workers/wrangler/commands/#pages
i do not see a preset option
the directory would be .output/server
NODE_PRESET=cloudflare-pages nitro build
or something
and then just wrangler pages dev <output>
ty
So I have added a data proxy and updated the build script
and now the error is:
I have the DATABASE_URL in the pages environment variables
Have you generated the Prisma project as described in the Prisma guide? https://www.prisma.io/docs/data-platform/data-proxy/use-data-proxy#generate-prisma-client-for-the-data-proxy
make sure that Prisma Client is auto-generated with the --data-proxy flag as described below.
yes,
I have also deployed it as a worker, and although it compiles it takes a very long time to get a response https://users-worker.data-well.workers.dev/
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I had the same experience (am using Nuxt 3). Tried to connect to Supabase DB (Postgres). Now already tried DataProxy but the error is still the same. Hopefully somebody here can help.
Just found the fix.
I changed the code to:
import { PrismaClient } from "@prisma/client/edge";
and now it is working!