cloudflare / workers-sdk

โ›…๏ธ Home to Wrangler, the CLI for Cloudflare Workersยฎ
https://developers.cloudflare.com/workers/
Apache License 2.0
2.58k stars 665 forks source link

๐Ÿ› BUG: wrangler pages dev doesn't support service bindings or the `--service` argument #3436

Closed trevhunter closed 4 months ago

trevhunter commented 1 year ago

Which Cloudflare product(s) does this pertain to?

Pages, Wrangler

What version of Wrangler are you using?

3.1.0

What operating system are you using?

WSL

Describe the Bug

According to documentation for wrangler pages dev, I should be able to run pages locally using wrangler and have it set up service bindings. However, wrangler 3.1.0 does not support the --service argument that is described in the documentation.

Steps:

  1. Set up a simple pages project.
  2. Run wrangler pages dev /. --service=SVC=SERVICE_NAME

Expected: Wrangler will set up the service binding as expected and documented, much like KV, R2, D1, DO and env vars. Actual: Wrangler returns an error [ERROR] Unknown argument: service

trevhunter commented 1 year ago

Further community thread at: https://community.cloudflare.com/t/using-service-binding-to-call-a-worker-from-a-pages-function-locally/489343/2

caracal7 commented 5 months ago

The same trouble. Are there any workarounds?

CarmenPopoviciu commented 4 months ago

hi folks, thank you for raising this issue.

I have tested running wrangler pages dev [directory] --service=SVC=SERVICE_NAME and everything works as expected ๐Ÿ‘‡

Screenshot 2024-04-25 at 14 46 20

I am running latest wrangler version 3.52.0.

We have recently added support for wrangler.toml in Pages, so service bindings can now be specified via the configuration file as well. Please keep in mind that support for service bindings in local mode is experimental and may change.

Closing this issue as can't reproduce. If you are still experiencing issues, pls feel to re-open and provide us with detailed repro steps ๐Ÿ™