Skip to content

Commit 744e09d

Browse files
committed
address feedback
1 parent a24d82c commit 744e09d

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed
Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Wrangler dev with multiple config files now supports worker bindings across dev commands
2+
title: Improved support for running multiple Workers with `wrangler dev`
33
description: Workers running with wrangler dev using multiple config files can now communicate with Workers running in separate dev commands.
44
products:
55
- workers
@@ -9,16 +9,36 @@ date: 2025-09-23
99
You can run multiple Workers in a single dev command by passing multiple config files to `wrangler dev`:
1010

1111
```sh
12-
wrangler dev --config ./app/wrangler.jsonc --config ./api/wrangler.jsonc
12+
wrangler dev --config ./web/wrangler.jsonc --config ./api/wrangler.jsonc
1313
```
1414

15-
Previously, these Workers could not communicate with Workers running in separate dev commands. Now service bindings and tail consumers work across dev commands:
15+
Previously, if you ran the command above and then also ran wrangler dev for a different Worker, the Workers running in separate wrangler dev sessions could not communicate with each other. This prevented you from being able to use [Service Bindings](https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/) and [Tail Workers](https://developers.cloudflare.com/workers/observability/logs/tail-workers/) in local development, when running separate wrangler dev sessions.
16+
17+
Now, the following works as expected:
1618

1719
```sh
18-
# Start another Workers (e.g. auth) on a new terminal
20+
# Terminal 1: Run your application that includes both Web and API workers
21+
wrangler dev --config ./web/wrangler.jsonc --config ./api/wrangler.jsonc
22+
23+
# Terminal 2: Run your auth worker separately
1924
wrangler dev --config ./auth/wrangler.jsonc
2025
```
2126

2227
These Workers can now communicate with each other across separate dev commands, regardless of your development setup.
2328

29+
```js title="./api/src/index.ts"
30+
export default {
31+
async fetch(request, env) {
32+
// Call the auth worker using a service binding
33+
const authorized = await env.AUTH.isAuthorized(request);
34+
35+
if (!authorized) {
36+
return new Response('Unauthorized', { status: 401 });
37+
}
38+
39+
return new Response('Hello from API Worker!', { status: 200 });
40+
},
41+
};
42+
```
43+
2444
Check out the [Developing with multiple Workers](/workers/development-testing/multi-workers) guide to learn more about the different approaches and when to use each one.

0 commit comments

Comments
 (0)