Skip to content

Commit 55eef6f

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

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

packages/nextjs/src/config/webpack.ts

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -633,19 +633,24 @@ 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: https://vercel.com/integrations/sentry";
641+
} else {
642+
msg =
640643
'You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/\n' +
641644
`After generating a Sentry auth token, set it via the ${chalk.bold.cyan(
642645
'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-
}`,
646+
)} environment variable during the build.`;
647+
}
648+
649+
// eslint-disable-next-line no-console
650+
console.warn(
651+
`${warningPrefix} ${chalk.bold(
652+
'No Sentry auth token configured.',
653+
)} Source maps will not be uploaded.\n${msg}\n`,
649654
);
650655

651656
return;

0 commit comments

Comments
 (0)