Can't get service binding to work when developing locally

I have a page function that has a service binding to another worker (token-service-dev). The binding works fine when page function is deployed, but I can't get it work when developing the page function locally. It looks like it works when runnning the project locally, but the service is always undefined. Is it possible to locally develop a page function and be connected to a live service? wrangler pages dev -- npx vite --host ✨ Compiled Worker successfully ⛅️ wrangler 3.36.0 (update available 3.37.0) ------------------------------------------------------- ▲ [WARNING] This worker is bound to live services: TokenAuth (token-service-dev) Your worker has access to the following bindings: - Services: - TokenAuth: token-service-dev
1 Reply
jensen
jensen9mo ago
I am currently doings this. I have two CF workers that I bind to my pages app. One is for a db proxy and the other is email rendering. I can bind them in development, but only when the workers are running in dev as well. I run my pages app, and the 2 cf workers in dev mode concurrently. This seems to let me use service bindings in dev locally
Want results from more Discord servers?
Add your server