Skip to content

Commit 2a1a2d5

Browse files
update the experimental_maybeStartOrUpdateRemoteProxySession parameters
1 parent c6c2de8 commit 2a1a2d5

File tree

1 file changed

+31
-29
lines changed
  • src/content/docs/workers/development-testing

1 file changed

+31
-29
lines changed

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

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -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 a potential target environment
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,34 @@ 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-
};
423-
424-
if (!mf) {
425-
mf = new Miniflare(miniflareOptions);
426-
} else {
427-
mf.setOptions(miniflareOptions);
428-
}
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+
}
429431
}
430432

431433
// ... tool logic that invokes `startOrUpdateDevSession()` ...

0 commit comments

Comments
 (0)