Workers with Secrets Store Secrets - Production Config
If you try to nest secrets store secrets like this in wranglers jsonc:
Then the bindings are not in the UI of the worker on the bindings page. The problem is in dev we have the same var names. so if we don't nest them as production in the jsonc file then the dev.vars conflict with the secrets store secrets namespace. What is the best advice on how to work with dev vs production with secrets store secrets???
4 Replies
I'm having the same problem (among a few others I'm facing right now with Secrets Store). ... I'm really struggling to define different secrets for different environments with Secret Store.
Side-note for any CloudFlare engineers: this documentation needs to be updated: (https://developers.cloudflare.com/workers/wrangler/configuration/) to add an item for
secrets_store_secrets (it's missing right now).Cloudflare Docs
Configuration
Use a configuration file to customize the development and deployment setup for your Worker project and other Developer Platform products.
My local dev.vars I put all my variables as "DEV_varname" and just setup some checks. Otherwise when you run dev on it the build process picks up 2 sets of variables with same namespace.
In the end I gave up using cloudflare secrets store. I found a solution that works for me that involves using file .dev.vars.staging (and .dev.vars.production) ... and calling npx wrangler secret bulk .dev.vars.staging just after deploying a worker (or npx wrangler secret bulk .dev.vars.production just after deploying production)