From 9ad5a251f3be37d79bb99d5531288614f2b2a3a2 Mon Sep 17 00:00:00 2001 From: Rohan Mukherjee Date: Tue, 14 Apr 2026 23:32:02 +0530 Subject: [PATCH 1/3] fix(miniflare): skip named entrypoint for flagship binding in remote mode In remote mode, the flagship binding is backed by a generic proxy worker that only has a default export. The plugin was telling workerd to look for a named entrypoint 'FlagshipBinding' which doesn't exist on it, causing wrangler dev to crash. Skip the named entrypoint in remote mode so workerd uses the default export, which correctly proxies all method calls to the remote service. --- packages/miniflare/src/plugins/flagship/index.ts | 14 ++++++++------ .../miniflare/test/plugins/flagship/index.spec.ts | 6 +++--- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/miniflare/src/plugins/flagship/index.ts b/packages/miniflare/src/plugins/flagship/index.ts index b675bf6bb8..ba22bdf648 100644 --- a/packages/miniflare/src/plugins/flagship/index.ts +++ b/packages/miniflare/src/plugins/flagship/index.ts @@ -35,11 +35,13 @@ export const FLAGSHIP_PLUGIN: Plugin = { name: getUserBindingServiceName( FLAGSHIP_PLUGIN_NAME, name, - config.remoteProxyConnectionString + config.remoteProxyConnectionString, ), - entrypoint: "FlagshipBinding", + entrypoint: config.remoteProxyConnectionString + ? undefined + : "FlagshipBinding", }, - }) + }), ); }, getNodeBindings(options: z.infer) { @@ -50,7 +52,7 @@ export const FLAGSHIP_PLUGIN: Plugin = { Object.keys(options.flagship).map((name) => [ name, new ProxyNodeBinding(), - ]) + ]), ); }, async getServices({ options }) { @@ -64,7 +66,7 @@ export const FLAGSHIP_PLUGIN: Plugin = { name: getUserBindingServiceName( FLAGSHIP_PLUGIN_NAME, name, - remoteProxyConnectionString + remoteProxyConnectionString, ), worker: remoteProxyConnectionString ? remoteProxyClientWorker(remoteProxyConnectionString, name) @@ -78,7 +80,7 @@ export const FLAGSHIP_PLUGIN: Plugin = { ], }, }; - } + }, ); }, }; diff --git a/packages/miniflare/test/plugins/flagship/index.spec.ts b/packages/miniflare/test/plugins/flagship/index.spec.ts index db9c56620b..03a4b8a316 100644 --- a/packages/miniflare/test/plugins/flagship/index.spec.ts +++ b/packages/miniflare/test/plugins/flagship/index.spec.ts @@ -96,7 +96,7 @@ test("flagship", async ({ expect }) => { }); const strDetailsRes = await mf.dispatchFetch( - "http://placeholder/string-details" + "http://placeholder/string-details", ); expect(await strDetailsRes.json()).toEqual({ flagKey: "variant", @@ -105,7 +105,7 @@ test("flagship", async ({ expect }) => { }); const numDetailsRes = await mf.dispatchFetch( - "http://placeholder/number-details" + "http://placeholder/number-details", ); expect(await numDetailsRes.json()).toEqual({ flagKey: "rate-limit", @@ -114,7 +114,7 @@ test("flagship", async ({ expect }) => { }); const objDetailsRes = await mf.dispatchFetch( - "http://placeholder/object-details" + "http://placeholder/object-details", ); expect(await objDetailsRes.json()).toEqual({ flagKey: "config", From 63f98b659925d17a5eede5e5a4fb4f8d5ca9e974 Mon Sep 17 00:00:00 2001 From: Rohan Mukherjee Date: Tue, 14 Apr 2026 23:33:53 +0530 Subject: [PATCH 2/3] Add changeset for flagship remote binding fix --- .changeset/fix-flagship-remote-entrypoint.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changeset/fix-flagship-remote-entrypoint.md diff --git a/.changeset/fix-flagship-remote-entrypoint.md b/.changeset/fix-flagship-remote-entrypoint.md new file mode 100644 index 0000000000..4172061590 --- /dev/null +++ b/.changeset/fix-flagship-remote-entrypoint.md @@ -0,0 +1,7 @@ +--- +"miniflare": patch +--- + +Fix `wrangler dev` crash when using a Flagship binding with `remote: true` + +In remote mode, the flagship binding is backed by a generic proxy worker that only has a default export. The plugin was requesting a named entrypoint `"FlagshipBinding"` which doesn't exist on it, causing workerd to reject the binding at startup. The named entrypoint is now omitted in remote mode so workerd routes to the default export, which correctly proxies all RPC calls to the remote Flagship service. From a5d879947b71f712aabe62a6b080bd7bdfcf4479 Mon Sep 17 00:00:00 2001 From: Rohan Mukherjee Date: Tue, 14 Apr 2026 23:35:25 +0530 Subject: [PATCH 3/3] Format flagship plugin and test files --- packages/miniflare/src/plugins/flagship/index.ts | 10 +++++----- packages/miniflare/test/plugins/flagship/index.spec.ts | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/miniflare/src/plugins/flagship/index.ts b/packages/miniflare/src/plugins/flagship/index.ts index ba22bdf648..e03dd282d6 100644 --- a/packages/miniflare/src/plugins/flagship/index.ts +++ b/packages/miniflare/src/plugins/flagship/index.ts @@ -35,13 +35,13 @@ export const FLAGSHIP_PLUGIN: Plugin = { name: getUserBindingServiceName( FLAGSHIP_PLUGIN_NAME, name, - config.remoteProxyConnectionString, + config.remoteProxyConnectionString ), entrypoint: config.remoteProxyConnectionString ? undefined : "FlagshipBinding", }, - }), + }) ); }, getNodeBindings(options: z.infer) { @@ -52,7 +52,7 @@ export const FLAGSHIP_PLUGIN: Plugin = { Object.keys(options.flagship).map((name) => [ name, new ProxyNodeBinding(), - ]), + ]) ); }, async getServices({ options }) { @@ -66,7 +66,7 @@ export const FLAGSHIP_PLUGIN: Plugin = { name: getUserBindingServiceName( FLAGSHIP_PLUGIN_NAME, name, - remoteProxyConnectionString, + remoteProxyConnectionString ), worker: remoteProxyConnectionString ? remoteProxyClientWorker(remoteProxyConnectionString, name) @@ -80,7 +80,7 @@ export const FLAGSHIP_PLUGIN: Plugin = { ], }, }; - }, + } ); }, }; diff --git a/packages/miniflare/test/plugins/flagship/index.spec.ts b/packages/miniflare/test/plugins/flagship/index.spec.ts index 03a4b8a316..db9c56620b 100644 --- a/packages/miniflare/test/plugins/flagship/index.spec.ts +++ b/packages/miniflare/test/plugins/flagship/index.spec.ts @@ -96,7 +96,7 @@ test("flagship", async ({ expect }) => { }); const strDetailsRes = await mf.dispatchFetch( - "http://placeholder/string-details", + "http://placeholder/string-details" ); expect(await strDetailsRes.json()).toEqual({ flagKey: "variant", @@ -105,7 +105,7 @@ test("flagship", async ({ expect }) => { }); const numDetailsRes = await mf.dispatchFetch( - "http://placeholder/number-details", + "http://placeholder/number-details" ); expect(await numDetailsRes.json()).toEqual({ flagKey: "rate-limit", @@ -114,7 +114,7 @@ test("flagship", async ({ expect }) => { }); const objDetailsRes = await mf.dispatchFetch( - "http://placeholder/object-details", + "http://placeholder/object-details" ); expect(await objDetailsRes.json()).toEqual({ flagKey: "config",