Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
9 changes: 9 additions & 0 deletions packages/astro/src/integration/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@

// We don't need to check for AUTH_TOKEN here, because the plugin will pick it up from the env
if (shouldUploadSourcemaps && command !== 'dev') {
// TODO(v9): Remove this warning
if (config.vite.build?.sourcemap === false) {

Check failure on line 39 in packages/astro/src/integration/index.ts

View workflow job for this annotation

GitHub Actions / Node (22) Unit Tests

Unhandled error

TypeError: Cannot read properties of undefined (reading 'build') ❯ Object.astro:config:setup src/integration/index.ts:39:27 ❯ test/integration/index.files.test.ts:30:43 This error originated in "test/integration/index.files.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running.

Check failure on line 39 in packages/astro/src/integration/index.ts

View workflow job for this annotation

GitHub Actions / Node (22) Unit Tests

test/integration/index.test.ts > sentryAstro integration > enables source maps and adds the sentry vite plugin if an auth token is detected

TypeError: Cannot read properties of undefined (reading 'build') ❯ Object.astro:config:setup src/integration/index.ts:39:27 ❯ test/integration/index.test.ts:41:49

Check failure on line 39 in packages/astro/src/integration/index.ts

View workflow job for this annotation

GitHub Actions / Node (22) Unit Tests

test/integration/index.test.ts > sentryAstro integration > falls back to default output dir, if out and root dir are not available

TypeError: Cannot read properties of undefined (reading 'build') ❯ Object.astro:config:setup src/integration/index.ts:39:27 ❯ test/integration/index.test.ts:77:49

Check failure on line 39 in packages/astro/src/integration/index.ts

View workflow job for this annotation

GitHub Actions / Node (22) Unit Tests

test/integration/index.test.ts > sentryAstro integration > sets the correct assets glob for vercel if the Vercel adapter is used

TypeError: Cannot read properties of undefined (reading 'build') ❯ Object.astro:config:setup src/integration/index.ts:39:27 ❯ test/integration/index.test.ts:103:49

Check failure on line 39 in packages/astro/src/integration/index.ts

View workflow job for this annotation

GitHub Actions / Node (22) Unit Tests

test/integration/index.test.ts > sentryAstro integration > prefers user-specified assets-globs over the default values

TypeError: Cannot read properties of undefined (reading 'build') ❯ Object.astro:config:setup src/integration/index.ts:39:27 ❯ test/integration/index.test.ts:141:49

Check failure on line 39 in packages/astro/src/integration/index.ts

View workflow job for this annotation

GitHub Actions / Node (22) Unit Tests

test/integration/index.test.ts > sentryAstro integration > injects client and server init scripts

TypeError: Cannot read properties of undefined (reading 'build') ❯ Object.astro:config:setup src/integration/index.ts:39:27 ❯ test/integration/index.test.ts:213:49

Check failure on line 39 in packages/astro/src/integration/index.ts

View workflow job for this annotation

GitHub Actions / Node (22) Unit Tests

test/integration/index.test.ts > sentryAstro integration > injects client and server init scripts

TypeError: Cannot read properties of undefined (reading 'build') ❯ Object.astro:config:setup src/integration/index.ts:39:27 ❯ test/integration/index.test.ts:213:49

Check failure on line 39 in packages/astro/src/integration/index.ts

View workflow job for this annotation

GitHub Actions / Node (22) Unit Tests

test/integration/index.test.ts > sentryAstro integration > doesn't inject client init script if `enabled.client` is `false`

TypeError: Cannot read properties of undefined (reading 'build') ❯ Object.astro:config:setup src/integration/index.ts:39:27 ❯ test/integration/index.test.ts:225:49

Check failure on line 39 in packages/astro/src/integration/index.ts

View workflow job for this annotation

GitHub Actions / Node (22) Unit Tests

test/integration/index.test.ts > sentryAstro integration > doesn't inject server init script if `enabled.server` is `false`

TypeError: Cannot read properties of undefined (reading 'build') ❯ Object.astro:config:setup src/integration/index.ts:39:27 ❯ test/integration/index.test.ts:236:49

Check failure on line 39 in packages/astro/src/integration/index.ts

View workflow job for this annotation

GitHub Actions / Node (20) Unit Tests

Unhandled error

TypeError: Cannot read properties of undefined (reading 'build') ❯ Object.astro:config:setup src/integration/index.ts:39:27 ❯ test/integration/index.files.test.ts:30:43 This error originated in "test/integration/index.files.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running.

Check failure on line 39 in packages/astro/src/integration/index.ts

View workflow job for this annotation

GitHub Actions / Node (20) Unit Tests

test/integration/index.test.ts > sentryAstro integration > enables source maps and adds the sentry vite plugin if an auth token is detected

TypeError: Cannot read properties of undefined (reading 'build') ❯ Object.astro:config:setup src/integration/index.ts:39:27 ❯ test/integration/index.test.ts:41:49

Check failure on line 39 in packages/astro/src/integration/index.ts

View workflow job for this annotation

GitHub Actions / Node (20) Unit Tests

test/integration/index.test.ts > sentryAstro integration > falls back to default output dir, if out and root dir are not available

TypeError: Cannot read properties of undefined (reading 'build') ❯ Object.astro:config:setup src/integration/index.ts:39:27 ❯ test/integration/index.test.ts:77:49

Check failure on line 39 in packages/astro/src/integration/index.ts

View workflow job for this annotation

GitHub Actions / Node (20) Unit Tests

test/integration/index.test.ts > sentryAstro integration > sets the correct assets glob for vercel if the Vercel adapter is used

TypeError: Cannot read properties of undefined (reading 'build') ❯ Object.astro:config:setup src/integration/index.ts:39:27 ❯ test/integration/index.test.ts:103:49

Check failure on line 39 in packages/astro/src/integration/index.ts

View workflow job for this annotation

GitHub Actions / Node (20) Unit Tests

test/integration/index.test.ts > sentryAstro integration > prefers user-specified assets-globs over the default values

TypeError: Cannot read properties of undefined (reading 'build') ❯ Object.astro:config:setup src/integration/index.ts:39:27 ❯ test/integration/index.test.ts:141:49

Check failure on line 39 in packages/astro/src/integration/index.ts

View workflow job for this annotation

GitHub Actions / Node (20) Unit Tests

test/integration/index.test.ts > sentryAstro integration > injects client and server init scripts

TypeError: Cannot read properties of undefined (reading 'build') ❯ Object.astro:config:setup src/integration/index.ts:39:27 ❯ test/integration/index.test.ts:213:49

Check failure on line 39 in packages/astro/src/integration/index.ts

View workflow job for this annotation

GitHub Actions / Node (20) Unit Tests

test/integration/index.test.ts > sentryAstro integration > injects client and server init scripts

TypeError: Cannot read properties of undefined (reading 'build') ❯ Object.astro:config:setup src/integration/index.ts:39:27 ❯ test/integration/index.test.ts:213:49

Check failure on line 39 in packages/astro/src/integration/index.ts

View workflow job for this annotation

GitHub Actions / Node (20) Unit Tests

test/integration/index.test.ts > sentryAstro integration > doesn't inject client init script if `enabled.client` is `false`

TypeError: Cannot read properties of undefined (reading 'build') ❯ Object.astro:config:setup src/integration/index.ts:39:27 ❯ test/integration/index.test.ts:225:49

Check failure on line 39 in packages/astro/src/integration/index.ts

View workflow job for this annotation

GitHub Actions / Node (20) Unit Tests

test/integration/index.test.ts > sentryAstro integration > doesn't inject server init script if `enabled.server` is `false`

TypeError: Cannot read properties of undefined (reading 'build') ❯ Object.astro:config:setup src/integration/index.ts:39:27 ❯ test/integration/index.test.ts:236:49

Check failure on line 39 in packages/astro/src/integration/index.ts

View workflow job for this annotation

GitHub Actions / Node (18) Unit Tests

Unhandled error

TypeError: Cannot read properties of undefined (reading 'build') ❯ Object.astro:config:setup src/integration/index.ts:39:27 ❯ test/integration/index.files.test.ts:30:43 This error originated in "test/integration/index.files.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running.

Check failure on line 39 in packages/astro/src/integration/index.ts

View workflow job for this annotation

GitHub Actions / Node (18) Unit Tests

test/integration/index.test.ts > sentryAstro integration > enables source maps and adds the sentry vite plugin if an auth token is detected

TypeError: Cannot read properties of undefined (reading 'build') ❯ Object.astro:config:setup src/integration/index.ts:39:27 ❯ test/integration/index.test.ts:41:49

Check failure on line 39 in packages/astro/src/integration/index.ts

View workflow job for this annotation

GitHub Actions / Node (18) Unit Tests

test/integration/index.test.ts > sentryAstro integration > falls back to default output dir, if out and root dir are not available

TypeError: Cannot read properties of undefined (reading 'build') ❯ Object.astro:config:setup src/integration/index.ts:39:27 ❯ test/integration/index.test.ts:77:49

Check failure on line 39 in packages/astro/src/integration/index.ts

View workflow job for this annotation

GitHub Actions / Node (18) Unit Tests

test/integration/index.test.ts > sentryAstro integration > sets the correct assets glob for vercel if the Vercel adapter is used

TypeError: Cannot read properties of undefined (reading 'build') ❯ Object.astro:config:setup src/integration/index.ts:39:27 ❯ test/integration/index.test.ts:103:49

Check failure on line 39 in packages/astro/src/integration/index.ts

View workflow job for this annotation

GitHub Actions / Node (18) Unit Tests

test/integration/index.test.ts > sentryAstro integration > prefers user-specified assets-globs over the default values

TypeError: Cannot read properties of undefined (reading 'build') ❯ Object.astro:config:setup src/integration/index.ts:39:27 ❯ test/integration/index.test.ts:141:49

Check failure on line 39 in packages/astro/src/integration/index.ts

View workflow job for this annotation

GitHub Actions / Node (18) Unit Tests

test/integration/index.test.ts > sentryAstro integration > injects client and server init scripts

TypeError: Cannot read properties of undefined (reading 'build') ❯ Object.astro:config:setup src/integration/index.ts:39:27 ❯ test/integration/index.test.ts:213:49

Check failure on line 39 in packages/astro/src/integration/index.ts

View workflow job for this annotation

GitHub Actions / Node (18) Unit Tests

test/integration/index.test.ts > sentryAstro integration > injects client and server init scripts

TypeError: Cannot read properties of undefined (reading 'build') ❯ Object.astro:config:setup src/integration/index.ts:39:27 ❯ test/integration/index.test.ts:213:49

Check failure on line 39 in packages/astro/src/integration/index.ts

View workflow job for this annotation

GitHub Actions / Node (18) Unit Tests

test/integration/index.test.ts > sentryAstro integration > doesn't inject client init script if `enabled.client` is `false`

TypeError: Cannot read properties of undefined (reading 'build') ❯ Object.astro:config:setup src/integration/index.ts:39:27 ❯ test/integration/index.test.ts:225:49

Check failure on line 39 in packages/astro/src/integration/index.ts

View workflow job for this annotation

GitHub Actions / Node (18) Unit Tests

test/integration/index.test.ts > sentryAstro integration > doesn't inject server init script if `enabled.server` is `false`

TypeError: Cannot read properties of undefined (reading 'build') ❯ Object.astro:config:setup src/integration/index.ts:39:27 ❯ test/integration/index.test.ts:236:49
logger.warn(
"You disabled sourcemaps with the `vite.build.sourcemap` option. Currently, the Sentry SDK will override this option to generate sourcemaps. In future versions, the Sentry SDK will not override the `vite.build.sourcemap` option if you explicitly disable it. If you want to generate and upload sourcemaps please set the `vite.build.sourcemap` option to 'hidden' or undefined.",
);
}

// TODO: Add deleteSourcemapsAfterUpload option and warn if it isn't set.

updateConfig({
vite: {
build: {
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/src/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ export type IgnoreWarningsOption = (
// The two possible formats for providing custom webpack config in `next.config.js`
export type WebpackConfigFunction = (config: WebpackConfigObject, options: BuildContext) => WebpackConfigObject;
export type WebpackConfigObject = {
devtool?: string;
devtool?: string | boolean;
plugins?: Array<WebpackPluginInstance>;
entry: WebpackEntryProperty;
output: { filename: string; path: string };
Expand Down
24 changes: 22 additions & 2 deletions packages/nextjs/src/config/webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,13 +336,33 @@ export function constructWebpackConfigFunction(

if (sentryWebpackPlugin) {
if (!userSentryOptions.sourcemaps?.disable) {
// TODO(v9): Remove this warning
if (newConfig.devtool === false) {
const runtimePrefix = !isServer ? 'Client' : runtime === 'edge' ? 'Edge' : 'Node.js';
// eslint-disable-next-line no-console
console.warn(
`[@sentry/nextjs - ${runtimePrefix}] You disabled sourcemaps with the Webpack \`devtool\` option. Currently, the Sentry SDK will override this option to generate sourcemaps. In future versions, the Sentry SDK will not override the \`devtool\` option if you explicitly disable it. If you want to generate and upload sourcemaps please set the \`devtool\` option to 'hidden-source-map' or undefined.`,
);
}

// TODO(v9): Remove this warning and print warning in case source map deletion is auto configured
if (!isServer && !userSentryOptions.sourcemaps?.deleteSourcemapsAfterUpload) {
// eslint-disable-next-line no-console
console.warn(
"[@sentry/nextjs] The Sentry SDK has enabled source map generation for your Next.js app. If you don't want to serve Source Maps to your users, either set the `deleteSourceMapsAfterUpload` option to true, or manually delete the source maps after the build. In future Sentry SDK versions `deleteSourceMapsAfterUpload` will default to `true`.",
);
}

// `hidden-source-map` produces the same sourcemaps as `source-map`, but doesn't include the `sourceMappingURL`
// comment at the bottom. For folks who aren't publicly hosting their sourcemaps, this is helpful because then
// the browser won't look for them and throw errors into the console when it can't find them. Because this is a
// front-end-only problem, and because `sentry-cli` handles sourcemaps more reliably with the comment than
// without, the option to use `hidden-source-map` only applies to the client-side build.
newConfig.devtool =
isServer || userNextConfig.productionBrowserSourceMaps ? 'source-map' : 'hidden-source-map';
if (isServer || userNextConfig.productionBrowserSourceMaps) {
newConfig.devtool = 'source-map';
} else {
newConfig.devtool = 'hidden-source-map';
}
}

newConfig.plugins = newConfig.plugins || [];
Expand Down
24 changes: 14 additions & 10 deletions packages/solidstart/src/vite/sourceMaps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,22 @@ export function makeSourceMapsVitePlugin(options: SentrySolidStartPluginOptions)
apply: 'build',
enforce: 'post',
config(config) {
const sourceMapsPreviouslyNotEnabled = !config.build?.sourcemap;
if (debug && sourceMapsPreviouslyNotEnabled) {
// TODO(v9): Remove this warning
if (config.build?.sourcemap === false) {
// eslint-disable-next-line no-console
console.log('[Sentry SolidStart Plugin] Enabling source map generation');
if (!sourceMapsUploadOptions?.filesToDeleteAfterUpload) {
// eslint-disable-next-line no-console
console.warn(
`[Sentry SolidStart PLugin] We recommend setting the \`sourceMapsUploadOptions.filesToDeleteAfterUpload\` option to clean up source maps after uploading.
[Sentry SolidStart Plugin] Otherwise, source maps might be deployed to production, depending on your configuration`,
);
}
console.warn(
"[Sentry SolidStart PLugin] You disabled sourcemaps with the `build.sourcemap` option. Currently, the Sentry SDK will override this option to generate sourcemaps. In future versions, the Sentry SDK will not override the `build.sourcemap` option if you explicitly disable it. If you want to generate and upload sourcemaps please set the `build.sourcemap` option to 'hidden' or undefined.",
);
}

// TODO(v9): Remove this warning and print warning in case source map deletion is auto configured
if (!sourceMapsUploadOptions?.filesToDeleteAfterUpload) {
// eslint-disable-next-line no-console
console.warn(
"[Sentry SolidStart PLugin] The Sentry SDK has enabled source map generation for your SolidStart app. If you don't want to serve Source Maps to your users, either configure the `filesToDeleteAfterUpload` option with a glob to remove source maps after uploading them, or manually delete the source maps after the build. In future Sentry SDK versions source maps will be deleted automatically after uploading them.",
);
}

return {
...config,
build: {
Expand Down
Loading