-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: implement crash reporter #365
base: main
Are you sure you want to change the base?
Conversation
// initialize Sentry | ||
Sentry.init({ | ||
dsn: SENTRY_DSN, | ||
integrations: [Sentry.electronMinidumpIntegration()], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ElectronMinidump will enable integration with crashReporter. This is only configured in Prod mode to reduce noise.
const def = { | ||
[VITE_DEV_SERVER_URL]: | ||
command === 'serve' | ||
? JSON.stringify(process.env[VITE_DEV_SERVER_URL]) | ||
: undefined, | ||
[VITE_NAME]: JSON.stringify(name), | ||
[SENTRY_DSN]: JSON.stringify(process.env.SENTRY_DSN), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need the Sentry DSN variable to be statically replaced during build time since env variables are not available during runtime in Prod.
sentryVitePlugin({ | ||
authToken: process.env.SENTRY_AUTH_TOKEN, | ||
org: process.env.SENTRY_ORG, | ||
project: process.env.SENTRY_PROJECT, | ||
}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This plugin uploads the source map to Sentry to help us identify the actual stack trace of an issue
Description
This PR integrates Sentry so we can collect information about crashes and other errors in the main process for production builds.
How to Test
This integration only works in production. You can either:
main.ts
locally to work in development environment and manually throw an error. Source maps will not be available in Sentry unless you configureSENTRY_AUTH_TOKEN
,SENTRY_PROJECT
andSENTRY_ORG
env vars locallyChecklist
npm run lint
) and all checks pass.npm test
) and all tests pass.Screenshots (if appropriate):
Related PR(s)/Issue(s)
Resolves #349