From b5d96ebaffa0769409f7471b6adc187d53e255f7 Mon Sep 17 00:00:00 2001 From: Charly Gomez Date: Thu, 23 Oct 2025 13:34:20 +0200 Subject: [PATCH 1/3] rm chalk --- .../src/config/loaders/wrappingLoader.ts | 5 +--- packages/nextjs/src/config/webpack.ts | 26 +++++-------------- 2 files changed, 7 insertions(+), 24 deletions(-) diff --git a/packages/nextjs/src/config/loaders/wrappingLoader.ts b/packages/nextjs/src/config/loaders/wrappingLoader.ts index c60563ccd241..3125102e9656 100644 --- a/packages/nextjs/src/config/loaders/wrappingLoader.ts +++ b/packages/nextjs/src/config/loaders/wrappingLoader.ts @@ -1,6 +1,5 @@ import commonjs from '@rollup/plugin-commonjs'; import { stringMatchesSomePattern } from '@sentry/core'; -import * as chalk from 'chalk'; import * as fs from 'fs'; import * as path from 'path'; import type { RollupBuild, RollupError } from 'rollup'; @@ -165,9 +164,7 @@ export default function wrappingLoader( if (!showedMissingAsyncStorageModuleWarning) { // eslint-disable-next-line no-console console.warn( - `${chalk.yellow('warn')} - The Sentry SDK could not access the ${chalk.bold.cyan( - 'RequestAsyncStorage', - )} module. Certain features may not work. There is nothing you can do to fix this yourself, but future SDK updates may resolve this.\n`, + "[@sentry/nextjs] The Sentry SDK could not access the 'RequestAsyncStorage' module. Certain features may not work. There is nothing you can do to fix this yourself, but future SDK updates may resolve this.", ); showedMissingAsyncStorageModuleWarning = true; } diff --git a/packages/nextjs/src/config/webpack.ts b/packages/nextjs/src/config/webpack.ts index 14f064ae2b0a..90c19574fd97 100644 --- a/packages/nextjs/src/config/webpack.ts +++ b/packages/nextjs/src/config/webpack.ts @@ -2,7 +2,6 @@ /* eslint-disable max-lines */ import { debug, escapeStringForRegex, loadModule, parseSemver } from '@sentry/core'; -import * as chalk from 'chalk'; import * as fs from 'fs'; import * as path from 'path'; import { sync as resolveSync } from 'resolve'; @@ -245,11 +244,7 @@ export function constructWebpackConfigFunction({ vercelCronsConfig = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'vercel.json'), 'utf8')).crons; if (vercelCronsConfig) { debug.log( - `${chalk.cyan( - 'info', - )} - Creating Sentry cron monitors for your Vercel Cron Jobs. You can disable this feature by setting the ${chalk.bold.cyan( - 'automaticVercelMonitors', - )} option to false in you Next.js config.`, + "[@sentry/nextjs] Creating Sentry cron monitors for your Vercel Cron Jobs. You can disable this feature by setting the 'automaticVercelMonitors' option to false in you Next.js config.", ); } } @@ -259,9 +254,8 @@ export function constructWebpackConfigFunction({ } else { // log but noop debug.error( - `${chalk.red( - 'error', - )} - Sentry failed to read vercel.json for automatic cron job monitoring instrumentation`, + 'error', + 'Sentry failed to read vercel.json for automatic cron job monitoring instrumentation', e, ); } @@ -344,11 +338,7 @@ export function constructWebpackConfigFunction({ ) { // eslint-disable-next-line no-console console.log( - `${chalk.yellow( - 'warn', - )} - It seems like you don't have a global error handler set up. It is recommended that you add a ${chalk.cyan( - 'global-error.js', - )} file with Sentry instrumentation so that React rendering errors are reported to Sentry. Read more: https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#react-render-errors-in-app-router (you can suppress this warning by setting SENTRY_SUPPRESS_GLOBAL_ERROR_HANDLER_FILE_WARNING=1 as environment variable)`, + "[@sentry/nextjs] It seems like you don't have a global error handler set up. It is recommended that you add a 'global-error.js' file with Sentry instrumentation so that React rendering errors are reported to Sentry. Read more: https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#react-render-errors-in-app-router (you can suppress this warning by setting SENTRY_SUPPRESS_GLOBAL_ERROR_HANDLER_FILE_WARNING=1 as environment variable)", ); showedMissingGlobalErrorWarningMsg = true; } @@ -541,9 +531,7 @@ function warnAboutMissingOnRequestErrorHandler(instrumentationFile: string | nul if (!process.env.SENTRY_SUPPRESS_INSTRUMENTATION_FILE_WARNING) { // eslint-disable-next-line no-console console.warn( - chalk.yellow( - '[@sentry/nextjs] Could not find a Next.js instrumentation file. This indicates an incomplete configuration of the Sentry SDK. An instrumentation file is required for the Sentry SDK to be initialized on the server: https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#create-initialization-config-files (you can suppress this warning by setting SENTRY_SUPPRESS_INSTRUMENTATION_FILE_WARNING=1 as environment variable)', - ), + '[@sentry/nextjs] Could not find a Next.js instrumentation file. This indicates an incomplete configuration of the Sentry SDK. An instrumentation file is required for the Sentry SDK to be initialized on the server: https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#create-initialization-config-files (you can suppress this warning by setting SENTRY_SUPPRESS_INSTRUMENTATION_FILE_WARNING=1 as environment variable)', ); } return; @@ -552,9 +540,7 @@ function warnAboutMissingOnRequestErrorHandler(instrumentationFile: string | nul if (!instrumentationFile.includes('onRequestError')) { // eslint-disable-next-line no-console console.warn( - chalk.yellow( - '[@sentry/nextjs] Could not find `onRequestError` hook in instrumentation file. This indicates outdated configuration of the Sentry SDK. Use `Sentry.captureRequestError` to instrument the `onRequestError` hook: https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#errors-from-nested-react-server-components', - ), + '[@sentry/nextjs] Could not find `onRequestError` hook in instrumentation file. This indicates outdated configuration of the Sentry SDK. Use `Sentry.captureRequestError` to instrument the `onRequestError` hook: https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#errors-from-nested-react-server-components', ); } } From ea3d62aa4cec9a019ccb58cc02b664fe8d4c2299 Mon Sep 17 00:00:00 2001 From: Charly Gomez Date: Thu, 23 Oct 2025 13:37:07 +0200 Subject: [PATCH 2/3] . --- packages/nextjs/src/config/webpack.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/nextjs/src/config/webpack.ts b/packages/nextjs/src/config/webpack.ts index 90c19574fd97..4484b1194bd2 100644 --- a/packages/nextjs/src/config/webpack.ts +++ b/packages/nextjs/src/config/webpack.ts @@ -254,8 +254,7 @@ export function constructWebpackConfigFunction({ } else { // log but noop debug.error( - 'error', - 'Sentry failed to read vercel.json for automatic cron job monitoring instrumentation', + '[@sentry/nextjs] Failed to read vercel.json for automatic cron job monitoring instrumentation', e, ); } From 9b0257047eff63020c2405c221dc54008651897f Mon Sep 17 00:00:00 2001 From: Charly Gomez Date: Thu, 23 Oct 2025 13:43:52 +0200 Subject: [PATCH 3/3] update deps --- packages/nextjs/package.json | 1 - yarn.lock | 16 ++++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/nextjs/package.json b/packages/nextjs/package.json index 40924e8abd31..26b3a172090a 100644 --- a/packages/nextjs/package.json +++ b/packages/nextjs/package.json @@ -87,7 +87,6 @@ "@sentry/react": "10.21.0", "@sentry/vercel-edge": "10.21.0", "@sentry/webpack-plugin": "^4.3.0", - "chalk": "3.0.0", "resolve": "1.22.8", "rollup": "^4.35.0", "stacktrace-parser": "^0.1.10" diff --git a/yarn.lock b/yarn.lock index 7a38d3f22cd3..06f8d3741128 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12615,14 +12615,6 @@ chalk@2.4.2, chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.4.1, chalk@^2.4. escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chalk@3.0.0, chalk@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4" - integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg== - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" - chalk@4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" @@ -12642,6 +12634,14 @@ chalk@^1.0.0: strip-ansi "^3.0.0" supports-color "^2.0.0" +chalk@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4" + integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + chalk@^4.0.0, chalk@^4.0.2, chalk@^4.1.0, chalk@^4.1.1, chalk@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01"