From 9f343d1fd344db541422105d2fb6fc24464f96d7 Mon Sep 17 00:00:00 2001 From: Dario Piotrowicz Date: Wed, 6 Aug 2025 12:58:06 +0100 Subject: [PATCH 1/2] include `auth` parameter in `maybeStartOrUpdateProxySession` docs --- src/content/docs/workers/development-testing/index.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/content/docs/workers/development-testing/index.mdx b/src/content/docs/workers/development-testing/index.mdx index 76cecc80666d7bb..07241925982c9e1 100644 --- a/src/content/docs/workers/development-testing/index.mdx +++ b/src/content/docs/workers/development-testing/index.mdx @@ -373,6 +373,7 @@ This wrapper simplifies proxy session management. It takes: - The path to your Wrangler config, or an object with remote bindings. - 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. It returns an object with the proxy session details if started or updated, or `null` if no proxy session is needed. From 3881712102362e72ff3a7514bf82db15c0ffe41c Mon Sep 17 00:00:00 2001 From: Dario Piotrowicz Date: Wed, 6 Aug 2025 13:00:24 +0100 Subject: [PATCH 2/2] fix formatting of `maybeStartOrUpdateRempteProxySession` example --- .../workers/development-testing/index.mdx | 63 +++++++++---------- 1 file changed, 29 insertions(+), 34 deletions(-) diff --git a/src/content/docs/workers/development-testing/index.mdx b/src/content/docs/workers/development-testing/index.mdx index 07241925982c9e1..5d74d8fe6490946 100644 --- a/src/content/docs/workers/development-testing/index.mdx +++ b/src/content/docs/workers/development-testing/index.mdx @@ -396,42 +396,37 @@ import { experimental_maybeStartOrUpdateRemoteProxySession } from "wrangler"; let mf: Miniflare | null; -let remoteProxySessionDetails: Awaited< -ReturnType - -> | null = 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()` ...