Skip to content

[wrangler] Mention --secrets-file in required-secrets error messages#14540

Closed
petebacondarwin wants to merge 1 commit into
mainfrom
pbd/issue-14258
Closed

[wrangler] Mention --secrets-file in required-secrets error messages#14540
petebacondarwin wants to merge 1 commit into
mainfrom
pbd/issue-14258

Conversation

@petebacondarwin

@petebacondarwin petebacondarwin commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Fixes #14258.

When a Worker declares secrets.required and is deployed for the first time, the remedies suggested by the error messages don't work: wrangler secret put fails because the Worker doesn't exist yet, and the one path that does work — --secrets-file — was never mentioned.

This updates the messages emitted by addRequiredSecretsInheritBindings and handleMissingSecretsError (in @cloudflare/deploy-helpers, surfaced through Wrangler) to point at --secrets-file:

  • First deploy (Worker does not exist yet): the error now leads with wrangler deploy --secrets-file <FILE> as the way to supply required secrets in a single step, and mentions wrangler secret put <NAME> only as the option for once the Worker exists.
  • Missing-secret API errors (deploy): now mention wrangler deploy --secrets-file <FILE> alongside the existing wrangler secret put <NAME> guidance.
  • Missing-secret API errors (versions upload): now mention wrangler versions upload --secrets-file <FILE> alongside the existing wrangler versions secret put <NAME> guidance.

This is scoped to the wording of these two error messages, per the actionable item called out in the issue. It does not change how secrets are actually supplied or routed.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: this only refines the wording of existing Wrangler CLI error messages; the --secrets-file flag and its behaviour are unchanged and already documented.

Open in Devin Review

When a Worker declares secrets.required and is deployed for the first time, `wrangler secret put` cannot set those secrets because the Worker does not exist yet. The first-deploy error now leads with `wrangler deploy --secrets-file <FILE>`, and the missing-secret API errors for deploy and versions upload now mention --secrets-file alongside the existing secret put guidance.
@changeset-bot

changeset-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 43b9062

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
wrangler Patch
@cloudflare/vite-plugin Patch
@cloudflare/vitest-pool-workers Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Jul 3, 2026
@workers-devprod workers-devprod requested review from a team and NuroDev and removed request for a team July 3, 2026 14:55
@workers-devprod

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/wrangler
Show detailed file reviewers
  • .changeset/required-secrets-mention-secrets-file.md: [@cloudflare/wrangler]
  • packages/deploy-helpers/src/deploy/helpers/secrets-validation.ts: [@cloudflare/wrangler]
  • packages/wrangler/src/tests/deploy/secrets.test.ts: [@cloudflare/wrangler]
  • packages/wrangler/src/tests/versions/secrets.test.ts: [@cloudflare/wrangler]

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

✅ All changesets look good

  • Version Type: patch is appropriate — this is a bug fix / small improvement to error messages.
  • Changelog Quality: The description clearly explains the user-facing change (mentioning --secrets-file in required-secrets error messages), the underlying problem (first deploys cannot use wrangler secret put before the Worker exists), and the remedy (the error now guides users toward --secrets-file).
  • Markdown Headers: No h1/h2/h3 headers found.
  • Analytics / Dependabot / Experimental features: Not applicable.

@ask-bonk

ask-bonk Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

All references are consistent. The change is clean, well-scoped, correctly handles all branches (first deploy, deploy API error, versions upload API error), tests are updated to match, and there's a valid changeset. The telemetryMessage labels are unchanged (stable, as recommended). No logic bugs, no compatibility issues, no incorrect behavior.

LGTM

github run

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@petebacondarwin

Copy link
Copy Markdown
Contributor Author

Just realised that there is already a PR here #14332

@github-project-automation github-project-automation Bot moved this from Untriaged to Done in workers-sdk Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

2 participants