Skip to content

Commit c86e63c

Browse files
author
Luca Forstner
committed
Don't show full warning on vercel
1 parent ebcbdda commit c86e63c

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

packages/nextjs/src/config/webpack.ts

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -633,19 +633,26 @@ export function getWebpackPluginOptions(
633633
// Hardcoded way to check for missing auth token until we have a better way of doing this.
634634
if (err && err.message.includes('Authentication credentials were not provided.')) {
635635
const warningPrefix = `${chalk.yellow('warn')} -`;
636-
// eslint-disable-next-line no-console
637-
console.warn(
638-
`${warningPrefix} ${
639-
`${chalk.bold('No Sentry auth token configured.')} Source maps will not be uploaded.\n` +
636+
637+
let msg;
638+
639+
if (process.env.VERCEL) {
640+
msg = `To fix this, use Sentry's Vercel integration to automatically set the ${chalk.bold.cyan(
641+
'SENTRY_AUTH_TOKEN',
642+
)} environment variable: https://vercel.com/integrations/sentry`;
643+
} else {
644+
msg =
640645
'You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/\n' +
641646
`After generating a Sentry auth token, set it via the ${chalk.bold.cyan(
642647
'SENTRY_AUTH_TOKEN',
643-
)} environment variable during the build.\n`
644-
}${
645-
process.env.VERCEL
646-
? "If you're deploying to Vercel, use the Vercel integration: https://vercel.com/integrations/sentry\n"
647-
: ''
648-
}`,
648+
)} environment variable during the build.`;
649+
}
650+
651+
// eslint-disable-next-line no-console
652+
console.warn(
653+
`${warningPrefix} ${chalk.bold(
654+
'No Sentry auth token configured.',
655+
)} Source maps will not be uploaded.\n${msg}\n`,
649656
);
650657

651658
return;

0 commit comments

Comments
 (0)