From b626c979414980719212546f2527c5b0c99afc52 Mon Sep 17 00:00:00 2001 From: Dario Piotrowicz Date: Wed, 30 Jul 2025 12:59:09 +0100 Subject: [PATCH 1/4] fix formatting of `experimental_maybeStartOrUpdateRemoteProxySession` example --- src/content/docs/workers/development-testing/index.mdx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/content/docs/workers/development-testing/index.mdx b/src/content/docs/workers/development-testing/index.mdx index a44d211dc05eadb..fc3872741ccf545 100644 --- a/src/content/docs/workers/development-testing/index.mdx +++ b/src/content/docs/workers/development-testing/index.mdx @@ -394,11 +394,11 @@ let remoteProxySessionDetails: Awaited Date: Wed, 30 Jul 2025 13:05:33 +0100 Subject: [PATCH 2/4] update the `experimental_maybeStartOrUpdateRemoteProxySession` parameters --- .../workers/development-testing/index.mdx | 60 ++++++++++--------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/src/content/docs/workers/development-testing/index.mdx b/src/content/docs/workers/development-testing/index.mdx index fc3872741ccf545..368d86dd27d0a36 100644 --- a/src/content/docs/workers/development-testing/index.mdx +++ b/src/content/docs/workers/development-testing/index.mdx @@ -364,7 +364,9 @@ This type conversion is temporary. In the future, the types will be unified so y This wrapper simplifies proxy session management. It takes: -- The path to your Wrangler config, or an object with remote bindings. +- An object that either contains + - the path to a Wrangler config and a potential target environment + - the name of the Worker and the bindings it is using - The current proxy session details (this parameter can be set to `null` or not being provided if none). - Potentially the auth data to use for the remote proxy session. @@ -392,34 +394,34 @@ let mf: Miniflare | null; let remoteProxySessionDetails: Awaited> | null = null; async function startOrUpdateDevSession() { - remoteProxySessionDetails = await experimental_maybeStartOrUpdateRemoteProxySession({ - bindings: { - MY_KV: { - type: 'kv_namespace', - id: 'kv-id', - experimental_remote: true, - } - } - }, - remoteProxySessionDetails - ); - - const miniflareOptions: MiniflareOptions = { - scriptPath: "./worker.js", - kvNamespaces: { - MY_KV: { - id: "kv-id", - remoteProxyConnectionString: - remoteProxySessionDetails?.session.remoteProxyConnectionString, - }, - }, - }; - - if (!mf) { - mf = new Miniflare(miniflareOptions); - } else { - mf.setOptions(miniflareOptions); - } +remoteProxySessionDetails = await experimental_maybeStartOrUpdateRemoteProxySession({ +bindings: { +MY_KV: { +type: 'kv_namespace', +id: 'kv-id', +experimental_remote: true, +} +} +}, +remoteProxySessionDetails +); + + const miniflareOptions: MiniflareOptions = { + scriptPath: "./worker.js", + kvNamespaces: { + MY_KV: { + id: "kv-id", + remoteProxyConnectionString: + remoteProxySessionDetails?.session.remoteProxyConnectionString, + }, + }, + }; + + if (!mf) { + mf = new Miniflare(miniflareOptions); + } else { + mf.setOptions(miniflareOptions); + } } // ... tool logic that invokes `startOrUpdateDevSession()` ... From fb50d1a32224f8bedb799eb87612b1986c2781b7 Mon Sep 17 00:00:00 2001 From: Dario Piotrowicz Date: Fri, 1 Aug 2025 10:30:15 +0100 Subject: [PATCH 3/4] fix formatting --- .../workers/development-testing/index.mdx | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/content/docs/workers/development-testing/index.mdx b/src/content/docs/workers/development-testing/index.mdx index 368d86dd27d0a36..01feeeb0748e432 100644 --- a/src/content/docs/workers/development-testing/index.mdx +++ b/src/content/docs/workers/development-testing/index.mdx @@ -394,34 +394,34 @@ let mf: Miniflare | null; let remoteProxySessionDetails: Awaited> | null = null; async function startOrUpdateDevSession() { -remoteProxySessionDetails = await experimental_maybeStartOrUpdateRemoteProxySession({ -bindings: { -MY_KV: { -type: 'kv_namespace', -id: 'kv-id', -experimental_remote: true, -} -} -}, -remoteProxySessionDetails -); - - const miniflareOptions: MiniflareOptions = { - scriptPath: "./worker.js", - kvNamespaces: { - MY_KV: { - id: "kv-id", - remoteProxyConnectionString: - remoteProxySessionDetails?.session.remoteProxyConnectionString, - }, - }, - }; - - if (!mf) { - mf = new Miniflare(miniflareOptions); - } else { - mf.setOptions(miniflareOptions); - } + remoteProxySessionDetails = await experimental_maybeStartOrUpdateRemoteProxySession({ + bindings: { + MY_KV: { + type: 'kv_namespace', + id: 'kv-id', + experimental_remote: true, + } + } + }, + remoteProxySessionDetails + ); + + const miniflareOptions: MiniflareOptions = { + scriptPath: "./worker.js", + kvNamespaces: { + MY_KV: { + id: "kv-id", + remoteProxyConnectionString: + remoteProxySessionDetails?.session.remoteProxyConnectionString, + }, + }, + }; + + if (!mf) { + mf = new Miniflare(miniflareOptions); + } else { + mf.setOptions(miniflareOptions); + } } // ... tool logic that invokes `startOrUpdateDevSession()` ... From 945c085e5fc291c7e6a05e7a1a26d42b2340c9e9 Mon Sep 17 00:00:00 2001 From: Dario Piotrowicz Date: Tue, 2 Sep 2025 10:09:11 +0100 Subject: [PATCH 4/4] Apply suggestions from code review Co-authored-by: Jun Lee --- src/content/docs/workers/development-testing/index.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/content/docs/workers/development-testing/index.mdx b/src/content/docs/workers/development-testing/index.mdx index 01feeeb0748e432..ef444ac087ab548 100644 --- a/src/content/docs/workers/development-testing/index.mdx +++ b/src/content/docs/workers/development-testing/index.mdx @@ -364,8 +364,8 @@ This type conversion is temporary. In the future, the types will be unified so y This wrapper simplifies proxy session management. It takes: -- An object that either contains - - the path to a Wrangler config and a potential target environment +- An object that contains either: + - the path to a Wrangler configuration and a potential target environment - the name of the Worker and the bindings it is using - The current proxy session details (this parameter can be set to `null` or not being provided if none). - Potentially the auth data to use for the remote proxy session.