What versions & operating system are you using?
Wrangler 4.118.0
Node.js 24.14.1
npm 11.11.0
Linux Docker container
Windows host with PowerShell 7.6.4
The affected secret was originally created through the "Workers & Pages" dashboard under "Settings" → "Variables and Secrets".
Please provide a link to a minimal reproduction
N/A
Describe the Bug
The Workers dashboard accepts secret variable names with accidental leading or trailing spaces.
For example, FIREBASE_SERVICE_ACCOUNT_JSON is deployed as a different binding from FIREBASE_SERVICE_ACCOUNT_JSON, without any warning.
This is difficult to notice and causes the expected env binding to be undefined.
Please trim surrounding whitespace automatically, or reject the name with a clear validation message before deployment.
Please provide any relevant error logs
$ npx wrangler secret list
[
{
"name": " FIREBASE_SERVICE_ACCOUNT_JSON",
"type": "secret_text"
},
{
"name": "OTHER_AUTH_SECRET_WITHOUT_WHITESPACE",
"type": "secret_text"
}
]
What versions & operating system are you using?
Wrangler 4.118.0
Node.js 24.14.1
npm 11.11.0
Linux Docker container
Windows host with PowerShell 7.6.4
The affected secret was originally created through the "Workers & Pages" dashboard under "Settings" → "Variables and Secrets".
Please provide a link to a minimal reproduction
N/A
Describe the Bug
The Workers dashboard accepts secret variable names with accidental leading or trailing spaces.
For example,
FIREBASE_SERVICE_ACCOUNT_JSONis deployed as a different binding fromFIREBASE_SERVICE_ACCOUNT_JSON, without any warning.This is difficult to notice and causes the expected
envbinding to beundefined.Please trim surrounding whitespace
automatically, or reject the name with a clear validation message before deployment.Please provide any relevant error logs
$ npx wrangler secret list [ { "name": " FIREBASE_SERVICE_ACCOUNT_JSON", "type": "secret_text" }, { "name": "OTHER_AUTH_SECRET_WITHOUT_WHITESPACE", "type": "secret_text" } ]