question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

🐛 BUG: Different workers created for different environments

See original GitHub issue

What version of Wrangler are you using?

1.19.12

What operating system are you using?

MacOS 12.3.1

Describe the Bug

Wrangler is adding the environment name to the worker while publishing, which creates separate workers for each environment.

For example, I have a worker named “foo”. wrangler publish --env production creates a new worker foo-production and wrangler publish --env staging creates a new worker foo-staging.

Reproduce the bug

A list of steps to reproduce the bug.

  1. Create a new project wrangler generate foo.
  2. Add production and staging environments to wrangler.toml (as below).
  3. Run wrangler publish --env production.
  4. Run wrangler publish --env staging.
  5. Notice the newly created workers “foo-production” and “foo-staging” both with the production environment.
name = "foo"
type = "javascript"

account_id = ""
workers_dev = true
route = ""
zone_id = ""
compatibility_date = "2022-05-07"

[env.production]
route = "*/*"

[env.staging]
route = "*/*"

Expected behavior

Only a single worker will be created named “foo” with two environments “production” and “staging”. Instead, it’s creating two workers with both of them having a production environment.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
threepointonecommented, May 8, 2022

This is working as designed https://developers.cloudflare.com/workers/platform/environments/#naming.

We also have newer service environments https://developers.cloudflare.com/workers/learning/using-services/ which is a first class abstraction that succeeds the existing environments and would work as you desire, but we’ll enable them by default in wrangler only after they become generally available, which should happen soon later this year.

0reactions
ignoramouscommented, Jul 12, 2022

Again, sorry about this, we’re actively working on fixing this.

Can you pls point to the gh-issue that tracks this effort for wrangler2?


Edit: Found it https://github.com/cloudflare/wrangler2/issues/27

Read more comments on GitHub >

github_iconTop Results From Across the Web

Different workers created for different environments #2251
Only a single worker will be created named "foo" with two environments "production" and "staging". Instead, it's creating two workers with both ......
Read more >
python - Celery: how to separate different environments with ...
One redis instance as broker (everything in the same database). On the "celery server", I run multiple worker instances through supervisor ( ...
Read more >
Solved: How do you handle defects through multiple environ...
Solved: Hello Atlassian/Jira community! I have a question for you today...how do you all handle managing defects through environments? Let me give.
Read more >
Environments · Cloudflare Workers docs
The Workers platform allows you to create and manage different environments. Through environments, you can deploy the same project to multiple ...
Read more >
Fixing the bugs in activity-based work environments - MultiBriefs
Research he and his colleagues conducted found that organizations often fail to account for differences in individuals' work assignments, work ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found