Local testing of service bindings
Log time user and listener, random poster. I have a question on testing workers locally with service bindings. This doc:
https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/#local-development
Shows how you can start a wrangler dev -c from multiple directories.
My Questions: Does running this command actualy start the local dev process for each of those TOML's or do I need to start them separately (I use 'npm run dev') or will that launch all of them? Sorry it just not clear from the doc what happens.
My Questions: Does running this command actualy start the local dev process for each of those TOML's or do I need to start them separately (I use 'npm run dev') or will that launch all of them? Sorry it just not clear from the doc what happens.
2 Replies
Support AI
According to the documentation, running
wrangler dev -c
with multiple configuration files will start a single dev process that includes all the specified Workers.
As stated in the documentation at https://developers.cloudflare.com/workers/development-testing/multi-workers/, "You can run multiple Workers in a single dev command by passing multiple configuration files to your dev server".
This means that you don't need to start them separately. Running wrangler dev -c
with multiple configuration files will launch all of them in a single dev process.
However, if you're using npm run dev
, it's likely that this command is set up to run wrangler dev
with a single configuration file. If you want to run multiple Workers, you'll need to modify the npm run dev
script to include the multiple configuration files.
For example, you can modify your package.json
to include a script like this:
This way, running npm run dev
will launch both Workers in a single dev process.Sources
Feedback
Feedback has been submitted! Thank you :)
This is an AI generated response, it may not be 100% accurate. Please validate the output. You can ask followups by replying to this message or mentioning me.
Recommend you update the docs page with this example.