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

feat: implement crash reporter #365

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Conversation

cristianoventura
Copy link
Collaborator

@cristianoventura cristianoventura commented Nov 27, 2024

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:

  • Option 1: test the artifacts for the temporary 0.8.1 release. This release has one commit ahead of this branch that calls an undefined function on startup which will report to Sentry
  • Option 2: change main.ts locally to work in development environment and manually throw an error. Source maps will not be available in Sentry unless you configure SENTRY_AUTH_TOKEN, SENTRY_PROJECT and SENTRY_ORG env vars locally

Checklist

  • I have performed a self-review of my code.
  • I have added tests for my changes.
  • I have run linter locally (npm run lint) and all checks pass.
  • I have run tests locally (npm test) and all tests pass.
  • I have commented on my code, particularly in hard-to-understand areas.

Screenshots (if appropriate):

image

Related PR(s)/Issue(s)

Resolves #349

@cristianoventura cristianoventura self-assigned this Nov 27, 2024
// initialize Sentry
Sentry.init({
dsn: SENTRY_DSN,
integrations: [Sentry.electronMinidumpIntegration()],
Copy link
Collaborator Author

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),
Copy link
Collaborator Author

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.

Comment on lines +30 to +34
sentryVitePlugin({
authToken: process.env.SENTRY_AUTH_TOKEN,
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
}),
Copy link
Collaborator Author

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

@cristianoventura cristianoventura marked this pull request as ready for review November 27, 2024 15:58
@cristianoventura cristianoventura requested a review from a team as a code owner November 27, 2024 15:58
@cristianoventura cristianoventura requested review from going-confetti, e-fisher and Llandy3d and removed request for a team November 27, 2024 15:58
@cristianoventura cristianoventura marked this pull request as draft November 27, 2024 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement crash reporter
1 participant