Skip to content

Commit c4462a3

Browse files
committed
chore: point user to setup missing SENTRY_AUTH_TOKEN in passThroughEnv on Turborepo
closes #674
1 parent 7e71b59 commit c4462a3

File tree

1 file changed

+9
-3
lines changed
  • packages/bundler-plugin-core/src

1 file changed

+9
-3
lines changed

packages/bundler-plugin-core/src/index.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,11 @@ export function sentryUnpluginFactory({
319319
const injectionCode = generateModuleMetadataInjectorCode(metadata);
320320
plugins.push(moduleMetadataInjectionPlugin(injectionCode));
321321
}
322-
322+
// https://turbo.build/repo/docs/reference/system-environment-variables#environment-variables-in-tasks
323+
const isRunningInTurboRepo = Boolean(process.env["TURBO_HASH"]);
324+
const TUROBOREPO_PASSTHROUGH_TOKEN_MSG = isRunningInTurboRepo
325+
? "\nYou seem to be using Truborepo, did you forget to put `SENTRY_AUTH_TOKEN` in `passThroughEnv`? https://turbo.build/repo/docs/reference/configuration#passthroughenv"
326+
: "";
323327
if (!options.release.name) {
324328
logger.debug(
325329
"No release name provided. Will not create release. Please set the `release.name` option to identify your release."
@@ -328,7 +332,8 @@ export function sentryUnpluginFactory({
328332
logger.debug("Running in development mode. Will not create release.");
329333
} else if (!options.authToken) {
330334
logger.warn(
331-
"No auth token provided. Will not create release. Please set the `authToken` option. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/"
335+
"No auth token provided. Will not create release. Please set the `authToken` option. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/" +
336+
TUROBOREPO_PASSTHROUGH_TOKEN_MSG
332337
);
333338
} else if (!options.org && !options.authToken.startsWith("sntrys_")) {
334339
logger.warn(
@@ -378,7 +383,8 @@ export function sentryUnpluginFactory({
378383
logger.debug("Running in development mode. Will not upload sourcemaps.");
379384
} else if (!options.authToken) {
380385
logger.warn(
381-
"No auth token provided. Will not upload source maps. Please set the `authToken` option. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/"
386+
"No auth token provided. Will not upload source maps. Please set the `authToken` option. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/" +
387+
TUROBOREPO_PASSTHROUGH_TOKEN_MSG
382388
);
383389
} else if (!options.org && !options.authToken.startsWith("sntrys_")) {
384390
logger.warn(

0 commit comments

Comments
 (0)