Skip to content

Commit b48fb68

Browse files
update the experimental_maybeStartOrUpdateRemoteProxySession parameters
1 parent c6c2de8 commit b48fb68

File tree

1 file changed

+34
-30
lines changed
  • src/content/docs/workers/development-testing

1 file changed

+34
-30
lines changed

src/content/docs/workers/development-testing/index.mdx

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ To verify that the certificate exchange and validation process work as expected.
247247

248248
}
249249

250-
```
250+
````
251251
</WranglerConfig>
252252

253253
#### [Images](/workers/wrangler/configuration/#images):
@@ -262,7 +262,7 @@ To connect to a high-fidelity version of the Images API, and verify that all tra
262262
"experimental_remote": true
263263
}
264264
}
265-
```
265+
````
266266
267267
</WranglerConfig>
268268
@@ -371,7 +371,9 @@ the bindings in an `Unstable_Config` object into a structure that can be passed
371371

372372
This wrapper simplifies proxy session management. It takes:
373373

374-
- The path to your Wrangler config, or an object with remote bindings.
374+
- An object that either contains
375+
- the path to a Wrangler config and the potential environment to targeted
376+
- the name of the Worker and the bindings it is using.
375377
- The current proxy session details (this parameter can be set to `null` or not being provided if none).
376378

377379
It returns an object with the proxy session details if started or updated, or `null` if no proxy session is needed.
@@ -398,34 +400,35 @@ let mf: Miniflare | null;
398400
let remoteProxySessionDetails: Awaited<ReturnType<typeof experimental_maybeStartOrUpdateRemoteProxySession>> | null = null;
399401

400402
async function startOrUpdateDevSession() {
401-
remoteProxySessionDetails = await experimental_maybeStartOrUpdateRemoteProxySession({
402-
bindings: {
403-
MY_KV: {
404-
type: 'kv_namespace',
405-
id: 'kv-id',
406-
experimental_remote: true,
407-
}
408-
}
409-
},
410-
remoteProxySessionDetails
411-
);
412-
413-
const miniflareOptions: MiniflareOptions = {
414-
scriptPath: "./worker.js",
415-
kvNamespaces: {
416-
MY_KV: {
417-
id: "kv-id",
418-
remoteProxyConnectionString:
419-
remoteProxySessionDetails?.session.remoteProxyConnectionString,
420-
},
421-
},
422-
};
403+
remoteProxySessionDetails = await experimental_maybeStartOrUpdateRemoteProxySession({
404+
bindings: {
405+
MY_KV: {
406+
type: 'kv_namespace',
407+
id: 'kv-id',
408+
experimental_remote: true,
409+
}
410+
}
411+
},
412+
remoteProxySessionDetails
413+
);
414+
415+
const miniflareOptions: MiniflareOptions = {
416+
scriptPath: "./worker.js",
417+
kvNamespaces: {
418+
MY_KV: {
419+
id: "kv-id",
420+
remoteProxyConnectionString:
421+
remoteProxySessionDetails?.session.remoteProxyConnectionString,
422+
},
423+
},
424+
};
425+
426+
if (!mf) {
427+
mf = new Miniflare(miniflareOptions);
428+
} else {
429+
mf.setOptions(miniflareOptions);
430+
}
423431

424-
if (!mf) {
425-
mf = new Miniflare(miniflareOptions);
426-
} else {
427-
mf.setOptions(miniflareOptions);
428-
}
429432
}
430433

431434
// ... tool logic that invokes `startOrUpdateDevSession()` ...
@@ -460,3 +463,4 @@ When using remote development, all bindings automatically connect to their remot
460463

461464
- When you run a remote development session using the `--remote` flag, a limit of 50 [routes](/workers/configuration/routing/routes/) per zone is enforced. Learn more in[ Workers platform limits](/workers/platform/limits/#number-of-routes-per-zone-when-using-wrangler-dev---remote).
462465

466+
```

0 commit comments

Comments
 (0)