Skip to content

Commit a3f4bf4

Browse files
Remove top level scope example
1 parent fb461ca commit a3f4bf4

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

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

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -131,24 +131,8 @@ secrets_store_secrets = [
131131

132132
## 3. Access the secret on the `env` object
133133

134-
[Bindings](/workers/runtime-apis/bindings/) are located on the `env` object, which can be accessed in several ways. Two examples are presented below. For further options, refer to the [Workers documentation](/workers/runtime-apis/bindings/#how-to-access-env).
134+
[Bindings](/workers/runtime-apis/bindings/) are located on the `env` object. To access the secret you first need an asynchronous call.
135135

136-
### Import `env` from `cloudflare:workers`
137-
138-
```js
139-
import { env } from "cloudflare:workers";
140-
import ApiClient from "example-api-client";
141-
142-
// MY_SECRETS_STORE_SECRET is now usable in top-level scope
143-
const APIkey = await env.MY_SECRETS_STORE_SECRET.get()
144-
const apiClient = ApiClient.new({ apiKey: APIKey });
145-
146-
export default {
147-
fetch(req) {
148-
// you can use apiClient configured before any request is handled
149-
},
150-
};
151-
```
152136

153137
### Pass `env` as an argument to `fetch`
154138

0 commit comments

Comments
 (0)