`cf deploy` deletes plain-text vars set outside the config: no equivalent of `keep_vars`
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 65/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- cli
Research direction
Start with the deploy command and the upload builder mentioned in the issue, then trace how worker configuration is read and how cf migrate handles keep_vars. Add a keepVars configuration or deploy flag that preserves externally managed plain-text vars, and ensure migration maps keep_vars; verify with the existing deploy and migration tests, if present.
Written by the indexing model from the issue text.
Description
cf version: 1.0.0-beta.12
What happens
cloudflare.config.ts has no equivalent of Wrangler's keep_vars. cf migrate says so:
├─ [required] keep_vars: The keep_vars is not supported by the new config and was not migrated.
├─ [required] env.test.keep_vars: The keep_vars is not supported by the new config and was not migrated.
So after migrating, every cf deploy replaces the Worker's plain-text vars with what the config declares, and deletes any var set some other way: in the dashboard, over the API, or by another tool. In beta.12's dist, the upload builder takes keepVars, but the deploy command passes keepVars: void 0. cf deploy has no --var / --keep-vars flag either.
This is the vars half of #72, which covers secrets, where --secrets-file gives a workaround. Vars have no workaround.
Why it matters
Some projects deliberately keep runtime configuration as plain vars that are set outside the config file, so they stay readable on the Worker. In our case a separate operator tool writes them over the API, and the repo's wrangler.jsonc declares none of them, with keep_vars: true. With Wrangler, a deploy from a checkout ships code and leaves those values alone. With cf deploy, the same deploy would wipe every one of them. This blocks our migration.
Ask
A keepVars option on the worker config (or a --keep-vars deploy flag), matching Wrangler's keep_vars: true. Mapping keep_vars in cf migrate would follow from it.
- Dominant language
- TypeScript
- Stars
- 853
- Forks
- 42
- Avg merge
- 17h 57m
- Merged PRs (30d)
- 146
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from cloudflare/cf
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
cloudflare/cf#344 ·
Maintainers usually reply within 1 day
-
upstream
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
cloudflare/cf#262 ·
Maintainers usually reply within 1 day
-
`cf dev` rejects `--port` and `--host` for Vite projects, including the `cf init` templatePossibly taken @jamesopstad claimed this 6 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
cloudflare/cf#223 · 2 assignees ·
Maintainers usually reply within 1 day
-
upstream
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
cloudflare/cf#179 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 58/100
cloudflare/cf#347 ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
OpenPetsHQ/openpets#273 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
fritzprix/libr-agent#2161 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
blackboardsh/electrobun#581 ·
-
backlog-skill effort:xs frontend infra ready-for-agent
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
LucasSantana-Dev/Lucky#2862 ·
Maintainers usually reply within 1 day