Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

`cf deploy` deletes plain-text vars set outside the config: no equivalent of `keep_vars`

Open
#197 1 comment 0 reactions 0 assignees View on GitHub

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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cloudflare/cf

All issues in cloudflare/cf

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.