You can run multiple Workers in a single dev command by passing multiple config files to wrangler dev:
wrangler dev --config ./web/wrangler.jsonc --config ./api/wrangler.jsoncPreviously, 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 and Tail Workers in local development, when running separate wrangler dev sessions.
Now, the following works as expected:
# Terminal 1: Run your application that includes both Web and API workerswrangler dev --config ./web/wrangler.jsonc --config ./api/wrangler.jsonc
# Terminal 2: Run your auth worker separatelywrangler dev --config ./auth/wrangler.jsoncThese Workers can now communicate with each other across separate dev commands, regardless of your development setup.
export default { async fetch(request, env) { // This service binding call now works across dev commands const authorized = await env.AUTH.isAuthorized(request);
if (!authorized) { return new Response('Unauthorized', { status: 401 }); }
return new Response('Hello from API Worker!', { status: 200 }); },};Check out the Developing with multiple Workers guide to learn more about the different approaches and when to use each one.
Source: Cloudflare
Latest Posts
- Amazon Bedrock Guardrails announces a new API targeting agentic AI workflows

- Amazon FSx for Lustre Intelligent-Tiering storage class is now available in 13 additional AWS Regions

- Amazon S3 Vectors now supports up to 10,000 similarity search results per query

- Amazon S3 adds annotations to provide AI agents and analytics tools with context for data discovery





![(Updated) Microsoft 365 Copilot | PowerPoint now supports enterprise image libraries via AEM (Adobe Experience Manager) [MC1217648] 5 (Updated) Microsoft 365 Copilot | PowerPoint now supports enterprise image libraries via AEM (Adobe Experience Manager) [MC1217648]](https://mwpro.co.uk/wp-content/uploads/2024/08/pexels-pixabay-220989-150x150.webp)