Secret text directly supported by wrangler

I want to have some secrets in my wrangler.jsonc file and have them when deployed. When adding secrets this way, it successfully deploys along with the secrets
"unsafe": {
"bindings": [
{
"type": "secret_text",
"name": "Stage",
"text": "{\"permanent\":false,\"mode\":\"test\"}"
},
// ... More secrets
"unsafe": {
"bindings": [
{
"type": "secret_text",
"name": "Stage",
"text": "{\"permanent\":false,\"mode\":\"test\"}"
},
// ... More secrets
However I get a warning message stating
▲ [WARNING] Processing dist/wrangler.json configuration:

- "unsafe" fields are experimental and may change or break at any time.
- "unsafe.bindings[0]":
{"type":"secret_text","name":"Stage","text":"{\"permanent\":false,\"mode\":\"test\"}"}
- The binding type "secret_text" is directly supported by wrangler.
Consider migrating this unsafe binding to a format for 'secret_text' bindings that is
supported by wrangler for optimal support.
For more details, see https://developers.cloudflare.com/workers/cli-wrangler/configuration
▲ [WARNING] Processing dist/wrangler.json configuration:

- "unsafe" fields are experimental and may change or break at any time.
- "unsafe.bindings[0]":
{"type":"secret_text","name":"Stage","text":"{\"permanent\":false,\"mode\":\"test\"}"}
- The binding type "secret_text" is directly supported by wrangler.
Consider migrating this unsafe binding to a format for 'secret_text' bindings that is
supported by wrangler for optimal support.
For more details, see https://developers.cloudflare.com/workers/cli-wrangler/configuration
My question is, if i want to have secrets in my wrangler.jsonc, what is the proper way to do it while avoiding warnings? I dont see anything relevant in the json schema. https://unpkg.com/wrangler@4.14.4/config-schema.json
2 Replies
Walshy
Walshy7mo ago
You shouldn't have secrets in wrangler config, you are meant to commit wrangler config and shouldn't have anything sensitive in there. Secrets should be added through wrangler secret put
firefly
fireflyOP7mo ago
That one could be a var, I have like 10 other ones that are api keys but just didn't include them in the message

Did you find this page helpful?