-
Notifications
You must be signed in to change notification settings - Fork 673
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
🚀 Feature Request: allow --name
alongside --env
#4123
Comments
Looking at #680 (the PR that added this limitation) and its related issue - #672, makes it sound like this shouldn't happen for newer Workers?
Looking at the code in https://github.com/cloudflare/workers-sdk/blob/main/packages/wrangler/src/config/validation.ts#L118C2-L121, looks like everyone's being hardcoded to a legacy environment. Might be worth revisiting @penalosa |
This sounds like a behaviour we should change, since it's possible to overwrite names per environment in wrangler.toml anyway (worth noting that legacyEnv is a bit of a misnomer—most people should be using legacyEnv since service environments were deprecated). @petebacondarwin do you remember why this change was made? |
@petebacondarwin any update here? |
OK I think could probably relax this error now for name and env passed as command line args, since I believe we support specifying the name inside an environment. The question previously was what should the user expect from these commands in the same Worker project, which has a name = "worker-in-toml"
env.staging.name = "worker-in-toml-env"
|
what you propose above matches my expectation perfectly: the give precedence to the CLI name arg, then the environment, then the toplevel. |
My biggest concern here is the case where someone naively adds either Imagine the case where you have an npm script like: {
"scripts": {
"deploy": "wrangler deploy --name=MyWorker"
}
} Running But running |
Describe the solution
We have this shameful in line our CI/CD:
I tried removing it, and sure enough, on the latest wrangler:
why does this limitation exist? this seems like a very straightforward need — for us, we create one worker per PR preview branch (like
gg-preview-pr-3455-gameserver
), so we do need to set the worker name dynamically, rather than checking it into git.The text was updated successfully, but these errors were encountered: