From 2a73b54182e70dcae6f255167ff415f2a661df59 Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Wed, 28 Oct 2026 11:07:35 +0000 Subject: [PATCH] [vite-plugin] Preserve v1 remote-binding error properties Consolidate the existing final backport diff before rebasing onto the current v1 stack. https://github.com/cloudflare/workers-sdk/pull/16542 --- .changeset/v1-remote-binding-error-properties.md | 7 +++++++ packages/remote-bindings/src/start-remote-proxy-session.ts | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .changeset/v1-remote-binding-error-properties.md diff --git a/.changeset/v1-remote-binding-error-properties.md b/.changeset/v1-remote-binding-error-properties.md new file mode 100644 index 00000000000..82478e037a1 --- /dev/null +++ b/.changeset/v1-remote-binding-error-properties.md @@ -0,0 +1,7 @@ +--- +"@cloudflare/vite-plugin": patch +--- + +Preserve machine-readable error properties from remote bindings + +Enable enhanced error serialization on the remote proxy Worker used by Vite plugin v1. Combined with Miniflare 5.20261023.1-beta, remote binding errors retain properties such as `code` and `numericCode` so Worker code can handle them without parsing error messages. diff --git a/packages/remote-bindings/src/start-remote-proxy-session.ts b/packages/remote-bindings/src/start-remote-proxy-session.ts index aa4d9d78daa..5f265a56101 100644 --- a/packages/remote-bindings/src/start-remote-proxy-session.ts +++ b/packages/remote-bindings/src/start-remote-proxy-session.ts @@ -122,7 +122,9 @@ export async function startRemoteProxySession( cliDisplayName: options.cliDisplayName, entrypointSource: remoteBindingsWorkerSource, compatibilityDate: "2025-04-28", - compatibilityFlags: [], + // Keep custom error names and properties (for example Artifacts `code` and + // `numericCode`) when errors cross from the remote binding into this worker. + compatibilityFlags: ["enhanced_error_serialization"], complianceRegion: options.complianceRegion, bindings: rawBindings, auth: getRemoteBindingsAuthHook(