Workers (3)·续2
Environment to use for operations, and for selecting .env and .dev.vars files - <code>--env-file</code><code>string</code>Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files - <code>--install-skills</code><code>boolean</code> default: false
Install Cloudflare skills for detected AI coding agents before running the command - <code>--profile</code><code>string</code>Use a specific auth profile
</details>
preview base-config secret put
Create or update a secret variable on the Preview base config
npmyarnpnpm
npx wrangler preview base-config secret put <KEY>
yarn wrangler preview base-config secret put <KEY>
pnpm wrangler preview base-config secret put <KEY>
<KEY>stringrequired
The secret name to be accessible in the Worker
- --worker-name string Name of the Worker to target (defaults to the name in your local config file)
<details>
<summary>
Global flags
</summary>
- <code>--v</code><code>boolean</code> alias: --version
Show version number - <code>--cwd</code><code>string</code>Run as if Wrangler was started in the specified directory instead of the current working directory - <code>--config</code><code>string</code> alias: --c
Path to Wrangler configuration file - <code>--env</code><code>string</code> alias: --e
Environment to use for operations, and for selecting .env and .dev.vars files - <code>--env-file</code><code>string</code>Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files - <code>--install-skills</code><code>boolean</code> default: false
Install Cloudflare skills for detected AI coding agents before running the command - <code>--profile</code><code>string</code>Use a specific auth profile
</details>
preview base-config secret delete
Delete a secret variable from the Preview base config
npmyarnpnpm
npx wrangler preview base-config secret delete <KEY>
yarn wrangler preview base-config secret delete <KEY>
pnpm wrangler preview base-config secret delete <KEY>
<KEY>stringrequired
The secret name to delete
- --skip-confirmation boolean alias: --ydefault: false
Skip the confirmation prompt
- --worker-name string Name of the Worker to target (defaults to the name in your local config file)
<details>
<summary>
Global flags
</summary>
- <code>--v</code><code>boolean</code> alias: --version
Show version number - <code>--cwd</code><code>string</code>Run as if Wrangler was started in the specified directory instead of the current working directory - <code>--config</code><code>string</code> alias: --c
Path to Wrangler configuration file - <code>--env</code><code>string</code> alias: --e
Environment to use for operations, and for selecting .env and .dev.vars files - <code>--env-file</code><code>string</code>Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files - <code>--install-skills</code><code>boolean</code> default: false
Install Cloudflare skills for detected AI coding agents before running the command - <code>--profile</code><code>string</code>Use a specific auth profile
</details>
preview base-config secret list
List all secrets on the Preview base config
npmyarnpnpm
npx wrangler preview base-config secret list
yarn wrangler preview base-config secret list
pnpm wrangler preview base-config secret list
--worker-namestringName of the Worker to target (defaults to the name in your local config file)--jsonbooleandefault: false
Return output as JSON
<details>
<summary>
Global flags
</summary>
- <code>--v</code><code>boolean</code> alias: --version
Show version number - <code>--cwd</code><code>string</code>Run as if Wrangler was started in the specified directory instead of the current working directory - <code>--config</code><code>string</code> alias: --c
Path to Wrangler configuration file - <code>--env</code><code>string</code> alias: --e
Environment to use for operations, and for selecting .env and .dev.vars files - <code>--env-file</code><code>string</code>Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files - <code>--install-skills</code><code>boolean</code> default: false
Install Cloudflare skills for detected AI coding agents before running the command - <code>--profile</code><code>string</code>Use a specific auth profile
</details>
preview base-config secret bulk
Upload multiple secrets to the Preview base config
npmyarnpnpm
npx wrangler preview base-config secret bulk [FILE]
yarn wrangler preview base-config secret bulk [FILE]
pnpm wrangler preview base-config secret bulk [FILE]
[FILE]stringThe file of key-value pairs to upload, as JSON or .env format--worker-namestringName of the Worker to target (defaults to the name in your local config file)
<details>
<summary>
Global flags
</summary>
- <code>--v</code><code>boolean</code> alias: --version
Show version number - <code>--cwd</code><code>string</code>Run as if Wrangler was started in the specified directory instead of the current working directory - <code>--config</code><code>string</code> alias: --c
Path to Wrangler configuration file - <code>--env</code><code>string</code> alias: --e
Environment to use for operations, and for selecting .env and .dev.vars files - <code>--env-file</code><code>string</code>Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files - <code>--install-skills</code><code>boolean</code> default: false
Install Cloudflare skills for detected AI coding agents before running the command - <code>--profile</code><code>string</code>Use a specific auth profile
</details>
delete
Delete your Worker and all associated Cloudflare developer platform resources.
wrangler delete [<SCRIPT>] [OPTIONS]
SCRIPTstring- The path to an entry point for your Worker. Only required if your Wrangler configuration file does not include a
mainkey (for example,main = "index.js"). --namestringoptional- Name of the Worker.
--envstringoptional- Perform on a specific environment.
--dry-runboolean(default: false) optional- Do not actually delete the Worker. This is useful for testing the output of
wrangler delete.
The following global flags work on every command:
--helpboolean- Show help.
--configstring(not supported by Pages)- Path to your Wrangler configuration file.
--cwdstring- Run as if Wrangler was started in the specified directory instead of the current working directory.
setup
🪄 Setup a project to work on Cloudflare
npmyarnpnpm
npx wrangler setup
yarn wrangler setup
pnpm wrangler setup
--yesbooleanalias: --ydefault: false
Answer "yes" to any prompts for configuring your project
- --build boolean default: false
Run your project's build command once it has been configured
- --dry-run boolean Runs the command without applying any filesystem modifications
<details>
<summary>
Global flags
</summary>
- <code>--v</code><code>boolean</code> alias: --version
Show version number - <code>--cwd</code><code>string</code>Run as if Wrangler was started in the specified directory instead of the current working directory - <code>--config</code><code>string</code> alias: --c
Path to Wrangler configuration file - <code>--env</code><code>string</code> alias: --e
Environment to use for operations, and for selecting .env and .dev.vars files - <code>--env-file</code><code>string</code>Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files - <code>--install-skills</code><code>boolean</code> default: false
Install Cloudflare skills for detected AI coding agents before running the command - <code>--profile</code><code>string</code>Use a specific auth profile
</details>
This command configures your project for Cloudflare Workers without deploying. It performs the same automatic project configuration as wrangler deploy, but does not deploy. This is useful when you want to review the generated configuration before deploying.
secret
Manage the secret variables for a Worker.
This action creates a new version of the Worker and deploys it immediately. To only create a new version of the Worker, use the wrangler versions secret commands.
secret put
Create or update a secret for a Worker
npmyarnpnpm
npx wrangler secret put <KEY>
yarn wrangler secret put <KEY>
pnpm wrangler secret put <KEY>
<KEY>stringrequired
The variable name to be accessible in the Worker
- --name string Name of the Worker. If this is not specified, it will default to the name specified in your Wrangler config file.
<details>
<summary>
Global flags
</summary>
- <code>--v</code><code>boolean</code> alias: --version
Show version number - <code>--cwd</code><code>string</code>Run as if Wrangler was started in the specified directory instead of the current working directory - <code>--config</code><code>string</code> alias: --c
Path to Wrangler configuration file - <code>--env</code><code>string</code> alias: --e
Environment to use for operations, and for selecting .env and .dev.vars files - <code>--env-file</code><code>string</code>Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files - <code>--install-skills</code><code>boolean</code> default: false
Install Cloudflare skills for detected AI coding agents before running the command - <code>--profile</code><code>string</code>Use a specific auth profile
</details>
When running this command, you will be prompted to input the secret's value:
npx wrangler secret put FOO
? Enter a secret value: > ***
🌀 Creating the secret for script worker-app
✨ Success! Uploaded secret FOO
The put command can also receive piped input. For example:
echo "-----BEGIN PRIVATE KEY-----\nM...==\n-----END PRIVATE KEY-----\n" | wrangler secret put PRIVATE_KEY
secret delete
Delete a secret from a Worker
npmyarnpnpm
npx wrangler secret delete <KEY>
yarn wrangler secret delete <KEY>
pnpm wrangler secret delete <KEY>
<KEY>stringrequired
The variable name to be accessible in the Worker
- --name string Name of the Worker. If this is not specified, it will default to the name specified in your Wrangler config file.
<details>
<summary>
Global flags
</summary>
- <code>--v</code><code>boolean</code> alias: --version
Show version number - <code>--cwd</code><code>string</code>Run as if Wrangler was started in the specified directory instead of the current working directory - <code>--config</code><code>string</code> alias: --c
Path to Wrangler configuration file - <code>--env</code><code>string</code> alias: --e
Environment to use for operations, and for selecting .env and .dev.vars files - <code>--env-file</code><code>string</code>Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files - <code>--install-skills</code><code>boolean</code> default: false
Install Cloudflare skills for detected AI coding agents before running the command - <code>--profile</code><code>string</code>Use a specific auth profile
</details>
secret list
List all secrets for a Worker
npmyarnpnpm
npx wrangler secret list
yarn wrangler secret list
pnpm wrangler secret list
--namestringName of the Worker. If this is not specified, it will default to the name specified in your Wrangler config file.--format"json" | "pretty"default: json
The format to print the secrets in
<details>
<summary>
Global flags
</summary>
- <code>--v</code><code>boolean</code> alias: --version
Show version number - <code>--cwd</code><code>string</code>Run as if Wrangler was started in the specified directory instead of the current working directory - <code>--config</code><code>string</code> alias: --c
Path to Wrangler configuration file - <code>--env</code><code>string</code> alias: --e
Environment to use for operations, and for selecting .env and .dev.vars files - <code>--env-file</code><code>string</code>Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files - <code>--install-skills</code><code>boolean</code> default: false
Install Cloudflare skills for detected AI coding agents before running the command - <code>--profile</code><code>string</code>Use a specific auth profile
</details>
The following is an example of listing the secrets for the current Worker.
npx wrangler secret list
[
{
"name": "FOO",
"type": "secret_text"
}
]
secret bulk
Create, update, or delete multiple secrets for a Worker in a single request, with up to 100 secrets per command.
npmyarnpnpm
npx wrangler secret bulk [FILE]
yarn wrangler secret bulk [FILE]
pnpm wrangler secret bulk [FILE]
[FILE]stringThe file of key-value pairs to create, update, or delete, as JSON in form {"key": "value", ...} or .env file in the form KEY=VALUE. Set a key to null in the JSON file to delete it. Deletion is not supported with .env files. If omitted, Wrangler expects to receive input from stdin rather than a file.--namestringName of the Worker. If this is not specified, it will default to the name specified in your Wrangler config file.
<details>
<summary>
Global flags
</summary>
- <code>--v</code><code>boolean</code> alias: --version
Show version number - <code>--cwd</code><code>string</code>Run as if Wrangler was started in the specified directory instead of the current working directory - <code>--config</code><code>string</code> alias: --c
Path to Wrangler configuration file - <code>--env</code><code>string</code> alias: --e
Environment to use for operations, and for selecting .env and .dev.vars files - <code>--env-file</code><code>string</code>Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files - <code>--install-skills</code><code>boolean</code> default: false
Install Cloudflare skills for detected AI coding agents before running the command - <code>--profile</code><code>string</code>Use a specific auth profile
</details>
Note
Deleting secrets by setting a key to null requires wrangler version 4.97.0 or later and JSON format. Deletion is not supported with .env files.
