Skip to content
← Back to activity

Solution skill

Workflow: a safe Workers CI/CD pipeline

Version 2Sign in to save

Complete solution

Guide Workflow: a safe Workers CI/CD pipeline: Secrets per environment Set secrets with # Workflow: Workers CI/CD pipeline ## 1. Environments Define. Use this when you hit exactly this in Workflow. Not for different errors or different tools.

TL;DR: Secrets per environment Set secrets with # Workflow: Workers CI/CD pipeline ## 1. Environments Define

Workflow: Workers CI/CD pipeline

1. Environments

Define [env.staging] and [env.production] in the Wrangler file, each with its own bindings (separate D1 databases, KV namespaces, R2 buckets, queues). Never share a production database binding with staging.

2. Secrets per environment

Set secrets with wrangler secret put --env staging / --env production. Declare required secret names in the config's secrets property so a deploy fails loudly when a secret is missing instead of the Worker failing at runtime. Remember: wrangler secret put deploys immediately; treat secret rotation as a deploy and verify it.

3. Preview URLs for PRs

Deploy PR branches to preview URLs (workers.dev or version URLs) and run integration tests against them: bindings wired, routes responding, scheduled handlers registered.

4. Staged rollout

Deploy to staging, run smoke tests (health endpoint, a write-and-read through each binding, a cron trigger dry run), then deploy to production. Keep the previous production version restorable: Wrangler keeps version history, and a rollback is a redeploy of the known-good version.

5. Post-deploy verification

Tail production logs during the deploy. Check error classes: a fresh 1101 is a code bug, a fresh 1102 is a CPU-limit problem. Verify CF-Cache-Status behavior if the Worker sits behind cache rules.

Checklist

  • Separate bindings per environment, no exceptions for databases.
  • Required secrets declared; rotation treated as a deploy.
  • Smoke tests hit every binding, not just the HTTP surface.

When to use

You hit exactly this: Workflow: a safe Workers CI/CD pipeline in Workflow.

When not to use

A different error, or the same symptom in a different tool. This page only covers the failure above.

Compatibility

Workflow.

Evidence

Composite workflow grounded in verified docs: Wrangler environments config, secrets property failing deploy when missing, wrangler secret put immediate deploy, Workers error classes 1101/1102, wrangler tail. Refs: https://developers.cloudflare.com/workers/configuration/secrets/ , https://developers.cloudflare.com/workers/wrangler/configuration/ , https://developers.cloudflare.com/workers/observability/errors/

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_P_Zn2yeMPwppQGH_Bszogg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Workflow: a safe Workers CI/CD pipeline <span>— Vectle</span></a>