From e1167b6d27e6dbd46a3bc152e3dd50b762987a7a Mon Sep 17 00:00:00 2001 From: RulaKhaled Date: Wed, 25 Jun 2025 16:11:45 +0300 Subject: [PATCH] fix(nextjs): Remove from default server external packages --- packages/nextjs/src/config/withSentryConfig.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/nextjs/src/config/withSentryConfig.ts b/packages/nextjs/src/config/withSentryConfig.ts index c8eabd00d85c..88050713ec8c 100644 --- a/packages/nextjs/src/config/withSentryConfig.ts +++ b/packages/nextjs/src/config/withSentryConfig.ts @@ -20,8 +20,12 @@ let showedExperimentalBuildModeWarning = false; // Packages we auto-instrument need to be external for instrumentation to work // Next.js externalizes some packages by default, see: https://nextjs.org/docs/app/api-reference/config/next-config-js/serverExternalPackages // Others we need to add ourselves +// +// NOTE: 'ai' (Vercel AI SDK) is intentionally NOT included in this list. +// When externalized, Next.js doesn't properly handle the package's conditional exports, +// specifically the "react-server" export condition. This causes client-side code to be +// loaded in server components instead of the appropriate server-side functions. export const DEFAULT_SERVER_EXTERNAL_PACKAGES = [ - 'ai', 'amqplib', 'connect', 'dataloader',