@@ -127,9 +127,14 @@ export default {
127127};
128128```
129129
130- Workers do not allow I/O outside of a request context. This means that certain bindings will
131- not work from the top-level context. For instance, making a call to the [ KV binding] ( /kv/concepts/kv-bindings/ )
132- will error, but making it from within a request will work.
130+ Workers do not allow I/O from outside a request context. This means that even
131+ though ` env ` is accessible from the top-level scope, you will not be able to access
132+ every binding's methods.
133+
134+ For instance, environment variables and secrets are accessible, and you are able to
135+ call ` env.NAMESPACE.get ` to get a [ Durable Object stub] ( /durable-objects/api/stub/ ) in the
136+ top-level context. However, calling methods on the Durable Object stub, making [ calls to a KV store] ( /kv/api/ ) ,
137+ and [ calling to other Workers] ( /workers/runtime-apis/bindings/service-bindings ) will not work.
133138
134139``` js
135140import { env } from " cloudflare:workers" ;
@@ -182,7 +187,7 @@ for dependency injection and testing.
182187The ` withEnv ` function provides a mechanism for overriding values of ` env ` .
183188
184189Imagine a user has defined the [ environment variable] ( /workers/configuration/environment-variables/ )
185- "NAME" to be "Alice" in their Wrangler configuration file and deployed a worker . By default, logging
190+ "NAME" to be "Alice" in their Wrangler configuration file and deployed a Worker . By default, logging
186191` env.NAME ` would print "Alice". Using the ` withEnv ` function, you can override the value of
187192"NAME".
188193
0 commit comments