Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 BUG: Different workers created for different environments #921

Closed
gijo-varghese opened this issue May 8, 2022 · 5 comments
Closed

Comments

@gijo-varghese
Copy link

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.

@threepointone
Copy link
Contributor

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.

@gijo-varghese
Copy link
Author

@threepointone so what's the point of "environments" in the dashboard? We can create environments in the dashboard, but can't deploy to them?!

@threepointone
Copy link
Contributor

Sorry for the frustration. We probably jumped the gun by enabling them in the dashboard as early as we did before we had proper wrangler support.

If you're interested, we have experimental support for service environments in wrangler, which you can enable by passing legacy_env = false in your wrangler.toml but CAUTION that the behaviour isn't well defined and may change soon, so I wouldn't recommend using that for production software just yet.

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

@gijo-varghese
Copy link
Author

@threepointone understood, thanks.

@ignoramous
Copy link

ignoramous commented 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 #27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants