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

Bindings while running wrangler pages dev #1

Closed
gerhardcit opened this issue Sep 30, 2023 · 3 comments
Closed

Bindings while running wrangler pages dev #1

gerhardcit opened this issue Sep 30, 2023 · 3 comments

Comments

@gerhardcit
Copy link

This is all fine and well, but is there in wrangler 3 a method yet to bind platform.env.DB while running in dev mode?

@elithrar
Copy link
Owner

@gerhardcit

npx wrangler pages dev --d1=DB -- npm run dev

@gerhardcit
Copy link
Author

seems like you haven't tried it.

start you app as indicated:

npx wrangler pages dev --d1=DB -- npm run dev
the test the api
curl http://127.0.0.1:8788/api/users

you will get this

✘ [ERROR] [proxy]: TypeError: Cannot read properties of undefined (reading 'env')

      at GET (/svelte-demo-d1/src/routes/api/users/+server.ts:4:31)

this issue is mentioned here:
https://kit.svelte.dev/docs/adapter-cloudflare#bindings-testing-locally

in wrangler v2 there were hacks with miniflare.. but since wrangler v3, I'm yet to find a real solution to develop sveltekit with bindings.

@gerhardcit
Copy link
Author

See #3 for a PR created as an option on how to handle local dev using wrangler-proxy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants