Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

EVG-20320: Upload Sentry source maps #2016

Merged
merged 5 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions .evergreen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ functions:
script: |
echo "Generating .env-cmdrc.json"
REACT_APP_BUGSNAG_API_KEY=${REACT_APP_BUGSNAG_API_KEY} \
REACT_APP_SENTRY_AUTH_TOKEN=${REACT_APP_SENTRY_AUTH_TOKEN} \
REACT_APP_SENTRY_DSN=${REACT_APP_SENTRY_DSN} \
REACT_APP_NEW_RELIC_ACCOUNT_ID=${REACT_APP_NEW_RELIC_ACCOUNT_ID} \
REACT_APP_NEW_RELIC_AGENT_ID=${REACT_APP_NEW_RELIC_AGENT_ID} \
Expand Down
3 changes: 0 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,5 @@ module.exports = {
"jest-watch-typeahead/testname",
],
globalSetup: "<rootDir>/global-setup.js",
globals: {
APP_VERSION: JSON.stringify(process.env.npm_package_version),
},
testTimeout: 30000,
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
"@graphql-codegen/typescript-operations": "4.0.1",
"@graphql-eslint/eslint-plugin": "3.18.0",
"@originjs/vite-plugin-commonjs": "1.0.3",
"@sentry/vite-plugin": "2.6.2",
"@storybook/addon-actions": "7.0.21",
"@storybook/addon-essentials": "7.0.21",
"@storybook/addon-interactions": "7.0.21",
Expand Down
1 change: 1 addition & 0 deletions scripts/setup-credentials.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const production = {
REACT_APP_SPRUCE_URL: "https://spruce.mongodb.com",
REACT_APP_RELEASE_STAGE: "production",
REACT_APP_BUGSNAG_API_KEY: process.env.REACT_APP_BUGSNAG_API_KEY,
REACT_APP_SENTRY_AUTH_TOKEN: process.env.REACT_APP_SENTRY_AUTH_TOKEN,
REACT_APP_SENTRY_DSN: process.env.REACT_APP_SENTRY_DSN,
REACT_APP_NEW_RELIC_ACCOUNT_ID: process.env.REACT_APP_NEW_RELIC_ACCOUNT_ID,
REACT_APP_NEW_RELIC_AGENT_ID: process.env.REACT_APP_NEW_RELIC_AGENT_ID,
Expand Down
1 change: 0 additions & 1 deletion src/components/ErrorHandling/Sentry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const initializeSentry = () => {
dsn: getSentryDSN(),
debug: !isProduction(),
normalizeDepth: 5,
release: APP_VERSION,
environment: releaseStage,
});
} catch (e) {
Expand Down
3 changes: 0 additions & 3 deletions src/components/ErrorHandling/initialize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ describe("should initialize error handlers according to release stage", () => {
dsn: "fake-sentry-key",
debug: false,
normalizeDepth: 5,
release: APP_VERSION,
environment: "production",
});
});
Expand All @@ -71,7 +70,6 @@ describe("should initialize error handlers according to release stage", () => {
dsn: "fake-sentry-key",
debug: true,
normalizeDepth: 5,
release: APP_VERSION,
environment: "beta",
});
});
Expand All @@ -95,7 +93,6 @@ describe("should initialize error handlers according to release stage", () => {
dsn: "fake-sentry-key",
debug: true,
normalizeDepth: 5,
release: APP_VERSION,
environment: "staging",
});
});
Expand Down
2 changes: 0 additions & 2 deletions src/vite-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ declare module "*.graphql" {
const content: DocumentNode;
export default content;
}

declare const APP_VERSION: string;
15 changes: 12 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineConfig } from "vite";
import { sentryVitePlugin } from "@sentry/vite-plugin";
import react from "@vitejs/plugin-react";
import * as fs from "fs";
import path from "path";
Expand Down Expand Up @@ -126,6 +127,17 @@ export default defineConfig({
filename: "build/source_map.html",
template: "treemap",
}),
sentryVitePlugin({
org: "mongodb-org",
project: "spruce",
authToken: process.env.REACT_APP_SENTRY_AUTH_TOKEN,
release: {
name: process.env.npm_package_version,
},
sourcemaps: {
assets: "./build/assets/*",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like from the upload link that minified files are being uploaded alongside the minified files. I think this suggestion might do the trick to limit that

Suggested change
assets: "./build/assets/*",
assets: "./build/assets/*.map",

Copy link
Contributor Author

@sophstad sophstad Sep 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The minified files should be uploaded with the sourcemaps! As per the docs:

For Sentry to de-minify your stack traces you must provide both the minified files (for example, app.min.js) and the corresponding source maps.

},
}),
],
css: {
preprocessorOptions: {
Expand All @@ -134,7 +146,4 @@ export default defineConfig({
},
},
},
define: {
APP_VERSION: JSON.stringify(process.env.npm_package_version),
},
});
Loading