From 0eabe958056a5bf47a4fb360fca6f3ec4e9576e6 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Mon, 13 Nov 2023 10:40:10 +0000 Subject: [PATCH] ref(nextjs): Improve wording in case CLI is missing --- packages/nextjs/src/config/webpack.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/nextjs/src/config/webpack.ts b/packages/nextjs/src/config/webpack.ts index 1ff0fbf9a6db..c3ff833a4e4c 100644 --- a/packages/nextjs/src/config/webpack.ts +++ b/packages/nextjs/src/config/webpack.ts @@ -35,6 +35,7 @@ const RUNTIME_TO_SDK_ENTRYPOINT_MAP = { let showedMissingAuthTokenErrorMsg = false; let showedMissingOrgSlugErrorMsg = false; let showedMissingProjectSlugErrorMsg = false; +let showedMissingCLiBinaryErrorMsg = false; let showedHiddenSourceMapsWarningMsg = false; // TODO: merge default SentryWebpackPlugin ignore with their SentryWebpackPlugin ignore or ignoreFile @@ -844,10 +845,15 @@ function shouldEnableWebpackPlugin(buildContext: BuildContext, userSentryOptions // @ts-expect-error - this exists, the dynamic import just doesn't know it if (!SentryWebpackPlugin || !SentryWebpackPlugin.cliBinaryExists()) { - // eslint-disable-next-line no-console - console.error( - `${chalk.red('error')} - ${chalk.bold('Sentry CLI binary not found.')} Source maps will not be uploaded.\n`, - ); + if (!showedMissingCLiBinaryErrorMsg) { + // eslint-disable-next-line no-console + console.error( + `${chalk.red('error')} - ${chalk.bold( + 'Sentry CLI binary not found.', + )} Source maps will not be uploaded. Please check that postinstall scripts are enabled in your package manager when installing your dependencies and please run your build once without any caching to avoid caching issues of dependencies.\n`, + ); + showedMissingCLiBinaryErrorMsg = true; + } return false; }