From d041e4e2bf0bb44dcdc5ea1686a00a3c0700b23a Mon Sep 17 00:00:00 2001 From: Enrico Ros Date: Mon, 27 Oct 2025 15:24:09 -0700 Subject: [PATCH] AIX: message the tRPC < 11.6 edge disconnections --- src/modules/aix/client/aix.client.errors.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/modules/aix/client/aix.client.errors.ts b/src/modules/aix/client/aix.client.errors.ts index 9a4fcafb6..0c283313d 100644 --- a/src/modules/aix/client/aix.client.errors.ts +++ b/src/modules/aix/client/aix.client.errors.ts @@ -38,6 +38,11 @@ export function aixClassifyStreamingError(error: any, isUserAbort: boolean, hasF if (error instanceof TypeError && error.message === 'network error') return { errorType: 'net-disconnected', errorMessage: 'An unexpected issue occurred: **network error**.' }; + // tRPC <= 11.5.1 - Vercel Edge network disconnects are thrown form tRPC as 'Stream closed' + // NOTE The behavior changed in 11.6+ for which we have an open upstream ticket: #6989 + if (error instanceof Error && error.message === 'Stream closed') + return { errorType: 'net-disconnected', errorMessage: 'An unexpected issue occurred: **connection terminated**.' }; + // tRPC-level protocol errors (wrapped by tRPC client) // Initial connection failures, HTTP errors, or text responses that blow up tRPC's JSON parser if (error instanceof TRPCClientError) {