Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@ for (const outputDir of OUTPUT_DIRS) {
}

// The app does not set `build.sourcemap`, so the SDK enables hidden maps and must delete them after upload.
// TODO: The default `filesToDeleteAfterUpload` globs miss static output, which writes maps to `dist/_astro`.
if (!isStatic) {
assert.deepEqual(findSourceMapFiles({ outputDir: BUILD_OUTPUT }), [], `Expected no source maps in ${BUILD_OUTPUT}`);
}
assert.deepEqual(findSourceMapFiles({ outputDir: BUILD_OUTPUT }), [], `Expected no source maps in ${BUILD_OUTPUT}`);

console.log('All sourcemap assertions passed!');
11 changes: 9 additions & 2 deletions packages/astro/src/integration/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,15 @@ export const sentryAstro = (options: SentryOptions = {}): AstroIntegration => {
typeof sourcemaps?.filesToDeleteAfterUpload === 'undefined' &&
computedSourceMapSettings.previousUserSourceMapSetting === 'unset'
) {
// This also works for adapters, as the source maps are also copied to e.g. the .vercel folder
updatedFilesToDeleteAfterUpload = ['./dist/**/client/**/*.map', './dist/**/server/**/*.map'];
// This also works for adapters, as the source maps are also copied to e.g. the .vercel folder.
// Static output has no client folder and writes client assets to `<outDir>/<build.assets>` instead.
// Astro removes the hidden `.prerender` folder itself, but we don't want to rely on that.
updatedFilesToDeleteAfterUpload = [
'./dist/**/client/**/*.map',
'./dist/**/server/**/*.map',
`./dist/**/${config.build?.assets ?? '_astro'}/**/*.map`,
'./dist/**/.prerender/**/*.map',
];

debug &&
logger.info(
Expand Down
28 changes: 24 additions & 4 deletions packages/astro/test/integration/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,12 @@ describe('sentryAstro integration', () => {
bundleSizeOptimizations: {},
sourcemaps: {
assets: ['out/**/*', 'out/**/.prerender/**/*'],
filesToDeleteAfterUpload: ['./dist/**/client/**/*.map', './dist/**/server/**/*.map'],
filesToDeleteAfterUpload: [
'./dist/**/client/**/*.map',
'./dist/**/server/**/*.map',
'./dist/**/_astro/**/*.map',
'./dist/**/.prerender/**/*.map',
],
},
_metaOptions: {
telemetry: {
Expand Down Expand Up @@ -143,7 +148,12 @@ describe('sentryAstro integration', () => {
bundleSizeOptimizations: {},
sourcemaps: {
assets: ['dist/**/*', 'dist/**/.prerender/**/*'],
filesToDeleteAfterUpload: ['./dist/**/client/**/*.map', './dist/**/server/**/*.map'],
filesToDeleteAfterUpload: [
'./dist/**/client/**/*.map',
'./dist/**/server/**/*.map',
'./dist/**/_astro/**/*.map',
'./dist/**/.prerender/**/*.map',
],
},
_metaOptions: {
telemetry: {
Expand Down Expand Up @@ -182,7 +192,12 @@ describe('sentryAstro integration', () => {
bundleSizeOptimizations: {},
sourcemaps: {
assets: ['{.vercel,dist}/**/*', '{.vercel,dist}/**/.prerender/**/*'],
filesToDeleteAfterUpload: ['./dist/**/client/**/*.map', './dist/**/server/**/*.map'],
filesToDeleteAfterUpload: [
'./dist/**/client/**/*.map',
'./dist/**/server/**/*.map',
'./dist/**/_astro/**/*.map',
'./dist/**/.prerender/**/*.map',
],
},
_metaOptions: {
telemetry: {
Expand Down Expand Up @@ -221,7 +236,12 @@ describe('sentryAstro integration', () => {
bundleSizeOptimizations: {},
sourcemaps: {
assets: ['dist/server/**/*, dist/client/**/*'],
filesToDeleteAfterUpload: ['./dist/**/client/**/*.map', './dist/**/server/**/*.map'],
filesToDeleteAfterUpload: [
'./dist/**/client/**/*.map',
'./dist/**/server/**/*.map',
'./dist/**/_astro/**/*.map',
'./dist/**/.prerender/**/*.map',
],
},
_metaOptions: {
telemetry: {
Expand Down
Loading