Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Suggest putting SENTRY_AUTH_TOKEN, SENTRY_ORG and SENTRY_PROJECT in passThroughEnv when using Turborepo #675

Merged
merged 4 commits into from
Feb 25, 2025
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions packages/bundler-plugin-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,12 @@ export function sentryUnpluginFactory({
const injectionCode = generateModuleMetadataInjectorCode(metadata);
plugins.push(moduleMetadataInjectionPlugin(injectionCode));
}

// https://turbo.build/repo/docs/reference/system-environment-variables#environment-variables-in-tasks
const isRunningInTurboRepo = Boolean(process.env["TURBO_HASH"]);
const getTruboRepoEnvPassthroughWarning = (envVarName: string) =>
isRunningInTurboRepo
? `\nYou seem to be using Truborepo, did you forget to put ${envVarName} in \`passThroughEnv\`? https://turbo.build/repo/docs/reference/configuration#passthroughenv`
: "";
if (!options.release.name) {
logger.debug(
"No release name provided. Will not create release. Please set the `release.name` option to identify your release."
Expand All @@ -328,15 +333,18 @@ export function sentryUnpluginFactory({
logger.debug("Running in development mode. Will not create release.");
} else if (!options.authToken) {
logger.warn(
"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/"
"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/" +
getTruboRepoEnvPassthroughWarning("SENTRY_AUTH_TOKEN")
);
} else if (!options.org && !options.authToken.startsWith("sntrys_")) {
logger.warn(
"No organization slug provided. Will not create release. Please set the `org` option to your Sentry organization slug."
"No organization slug provided. Will not create release. Please set the `org` option to your Sentry organization slug." +
getTruboRepoEnvPassthroughWarning("SENTRY_ORG")
);
} else if (!options.project) {
logger.warn(
"No project provided. Will not create release. Please set the `project` option to your Sentry project slug."
"No project provided. Will not create release. Please set the `project` option to your Sentry project slug." +
getTruboRepoEnvPassthroughWarning("SENTRY_PROJECT")
);
} else {
plugins.push(
Expand Down Expand Up @@ -378,7 +386,8 @@ export function sentryUnpluginFactory({
logger.debug("Running in development mode. Will not upload sourcemaps.");
} else if (!options.authToken) {
logger.warn(
"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/"
"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/" +
getTruboRepoEnvPassthroughWarning
);
} else if (!options.org && !options.authToken.startsWith("sntrys_")) {
logger.warn(
Expand Down
Loading