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

Cloudflare Pages + Prisma - Cannot read datasource from environment variable #4532

Open
inssein opened this issue Nov 6, 2022 · 2 comments

Comments

@inssein
Copy link

inssein commented Nov 6, 2022

What version of Remix are you using?

1.7.5

Steps to Reproduce

Start a new base project with remix + cloudflare, and add prisma.

This bug is related to prisma/prisma#15958 on the prisma end.

While this bug seems mostly on the prisma end, I feel like there will be some wiring up needed on the remix end when creating the cloudflare pages handler.

Expected Behavior

Prisma should be able to initialize a datasource from the DATABASE_URL env variable

Actual Behavior

ReferenceError: DATABASE_URL is not defined.
Attempted to access binding using global in modules.
You must use the 2nd `env` parameter passed to exported handlers/Durable Object constructors, or `context.env` with Pages Functions.
@craigsc
Copy link

craigsc commented Nov 11, 2022

Also hit this issue, it's due to the new module syntax for workers/pages. I unblocked myself by shifting to use Remix's cloudflare worker setup instead since that one still uses the older non-module syntax which is supported by Prisma out of the box.

@machour machour changed the title Remix + Cloudflare Pages + Prisma - Cannot read datasource from environment variable Cloudflare Pages + Prisma - Cannot read datasource from environment variable Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants