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(