Skip to content

Commit 4602717

Browse files
Call out local development setup cannot access production secrets
1 parent b29e07b commit 4602717

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/content/docs/secrets-store/integrations/workers.mdx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,21 @@ import { WranglerConfig, Tabs, TabItem } from "~/components";
1111
[Cloudflare Secrets Store](/secrets-store/) is a secure, centralized location in which account-level secrets are stored and managed. The secrets are securely encrypted and stored across all Cloudflare data centers.
1212

1313
Consider the steps below to learn how to use values from your account secrets store with [Cloudflare Workers](/workers/).
14-
1514
:::note
1615
This is different from Workers [Variables and Secrets](/workers/configuration/secrets/), where you define and manage your secrets on a per-Worker level.
1716
:::
1817

1918
## Before you begin
2019

21-
If [using the Dashboard](#via-dashboard), make sure you already have a Workers application. Refer to the [Workers get started](/workers/get-started/dashboard/) for guidance.
20+
- If [using the Dashboard](#via-dashboard), make sure you already have a Workers application. Refer to the [Workers get started](/workers/get-started/dashboard/) for guidance.
2221

23-
You should also have a store created under the Secrets Store tab on the Dashboard. The first store in your account is created automatically when a user with [Super Administrator or Secrets Store Admin role](/secrets-store/access-control/) interacts with it.
22+
- You should also have a store created under the Secrets Store tab on the Dashboard.
23+
- The first store in your account is created automatically when a user with [Super Administrator or Secrets Store Admin role](/secrets-store/access-control/) interacts with it.
24+
- You can also use the [Wrangler command](/workers/wrangler/commands/#secrets-store-store) `secrets-store store create <name> --remote` to create your first store.
2425

25-
You can also use the [Wrangler command](/workers/wrangler/commands/#secrets-store-store) `secrets-store store create <name>` to create your first store.
26+
:::caution[Local development mode]
27+
This guide assumes you are working in production. To use Secrets Store locally, you must use `secrets-store` [Wrangler commands](/workers/wrangler/commands/) without the `--remote` flag.
28+
:::
2629

2730
## 1. Set up account secrets in Secrets Store
2831

@@ -35,7 +38,9 @@ You may also add account secrets directly from the Workers settings on the dashb
3538

3639
Use the [Wrangler command](/workers/wrangler/commands/#secrets-store-secret) `secrets-store secret create`.
3740

38-
To use the following example, replace the store ID and secret name by your actual data. You can find and copy the store ID from the [Secrets Store tab](https://dash.cloudflare.com/?to=/:account/secrets-store/) on the dashboard. A secret name cannot contain spaces.
41+
To use the following example, replace the store ID and secret name by your actual data. You can find and copy the store ID from the [Secrets Store tab](https://dash.cloudflare.com/?to=/:account/secrets-store/) on the dashboard or use `wrangler secrets-store store list`.
42+
43+
Note that a secret name cannot contain spaces.
3944

4045
```sh
4146
npx wrangler secrets-store secret create <STORE_ID> --name MY_SECRET_NAME --scopes workers --remote
@@ -132,9 +137,12 @@ secrets_store_secrets = [
132137

133138
[Bindings](/workers/runtime-apis/bindings/) are located on the `env` object. To access the secret you first need an asynchronous call.
134139

135-
136140
### Call `get()` on the binding variable
137141

142+
:::caution[Local development mode]
143+
You cannot access production secrets (created on the dashboard, via API, or with the `--remote` flag) from your local development setup. To use Secrets Store locally, you must use [secrets-store Wrangler commands](/workers/wrangler/commands/) without the `--remote` flag.
144+
:::
145+
138146
```js
139147
export default {
140148
async fetch(request, env) {

0 commit comments

Comments
 (0)