Back to all status updates

Tip: Secrets for Cloudflare Workers

Published 📅: ....
Last modified 📝: ....
Location 📍: Boston, MA

Share this status update on BlueskySee discussion on Bluesky


To add a secret to a worker (where there's a wrangler.jsonc/.toml file in the current directory):

bunx wrangler secret put SECRET_NAME

It'll prompt for the value of the secret, and you'll be all set!

Generated Types

To add that new secret to the generated types from bun wrangler types, you'll need to do the following:

  • create a .env.local file
  • Add a stub of the secret there
  • Run bun wrangler types to re-generate types

See this feature request to make this workflow a bit easier!


Docs: https://developers.cloudflare.com/workers/configuration/secrets/


Tags:

Loading...