You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/workers/development-testing/index.mdx
+27-1Lines changed: 27 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -298,7 +298,8 @@ Certain bindings are not supported for remote connections during local developme
298
298
299
299
If `experimental_remote: true` is specified in Wrangler configuration for any of the following unsupported binding types, Cloudflare **will issue an error**. See [all supported and unsupported bindings for remote bindings](/workers/development-testing/bindings-per-env/).
300
300
301
-
-[**Durable Objects**](/workers/wrangler/configuration/#durable-objects): Enabling remote connections for Durable Objects may be supported in the future, but currently will always run locally.
301
+
-[**Durable Objects**](/workers/wrangler/configuration/#durable-objects): Enabling remote connections for Durable Objects may be supported in the future, but currently will always run locally. Using Durable Objects in combination with remote bindings is however possible
302
+
as illustrated in the [Durable Objects usage section](#durable-objects-usage-with-remote-resources) below.
302
303
303
304
-[**RPC on service bindings**](/workers/runtime-apis/bindings/service-bindings/rpc/): While you can make `fetch()` calls on remote service bindings, you cannot currently call RPC methods on remote service bindings.
304
305
@@ -324,6 +325,31 @@ If you have use-cases for connecting to any of the remote resources above, pleas
324
325
325
326
</Aside>
326
327
328
+
#### Durable Objects Usage with Remote Resources
329
+
330
+
While Durable Objects cannot currently run in remote mode, you can still use them during local development and have them interact with remote resources.
331
+
332
+
There are two main approaches for this:
333
+
334
+
-**Local Durable Objects with remote bindings:**
335
+
336
+
When you enable remote mode for a binding in your [Wrangler configuration](/workers/wrangler/configuration), both your main Worker and any local Durable Object
337
+
can make use of it. This allows Durable Objects to interact with remote resources during local development.
338
+
339
+
-**Remote Durable Objects with local Workers:**
340
+
341
+
You can run Durable Objects remotely from a Worker using [`wrangler dev --remote`](/workers/wrangler/commands/#dev) and have them interact with local Workers
342
+
running on your machine by leveraging Wrangler's [Multiple dev commands](./multi-workers/#multiple-dev-commands) feature.
343
+
344
+
To do this:
345
+
346
+
- Start your remote Worker (which contains the Durable Object) using `wrangler dev --remote`.
347
+
348
+
- In your local Workers' configuration, set the Durable Object's [`script_name`](/workers/wrangler/configuration/#durable-objects) to the name of the remote Worker.
349
+
350
+
- Run your local Workers with `wrangler dev` to connect to the remote Durable Object.
351
+
352
+
327
353
### Important Considerations
328
354
329
355
-**Data modification**: Operations (writes, deletes, updates) on bindings connected remotely will affect your actual data in the targeted Cloudflare resource (be it preview or production).
0 commit comments