Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Svelte: add sentry#63126

Merged
camdencheek merged 10 commits into
mainfrom
cc/integrate-sentry
Jun 7, 2024
Merged

Svelte: add sentry#63126
camdencheek merged 10 commits into
mainfrom
cc/integrate-sentry

Conversation

@camdencheek

@camdencheek camdencheek commented Jun 6, 2024

Copy link
Copy Markdown
Member

This adds basic sentry support to the Sveltekit webapp.

Fixes SRCH-90

Additionally, it configures Vite to generate source maps as part of the build so the stack traces in Sentry are readable. I configured it to build public source maps because our source code is already public and this means we don't need to add any special hooks in CI.

Test plan

Created a test project in Sentry and viewed unhandled exceptions from my local installation. Note that Firefox's "Enhanced Tracking Protection" blocks Sentry, as do many adblockers, so it's likely this won't work for many users. I did, however, test that the application still works find even if Sentry fails to load.

@cla-bot cla-bot Bot added the cla-signed label Jun 6, 2024
@camdencheek camdencheek changed the base branch from main to cc/svelte-analytics-inverted June 6, 2024 15:04
Base automatically changed from cc/svelte-analytics-inverted to main June 6, 2024 15:33
@camdencheek camdencheek force-pushed the cc/integrate-sentry branch from 06e5e9d to b281ebf Compare June 6, 2024 15:37
@camdencheek camdencheek requested a review from a team June 6, 2024 17:13
@camdencheek camdencheek marked this pull request as ready for review June 6, 2024 17:13

@fkling fkling left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🥳 very excited about making better use of this

import * as Sentry from '@sentry/sveltekit'

Sentry.init({
dsn: window.context.sentryDSN ?? undefined,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What happens on the sentry side of things when dsn is undefined? And when would it be undefined? Dotcom, cloud, self-hosted?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'll add a comment, but sentry is just disabled if the DSN is undefined

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The DSN is settable in site config, and I know it's set by default for dotcom and S2, but I don't think we set it for customer instances. I plan to follow up with the cloud team to ask about that

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

sentry is just disabled if the DSN is undefined

Good, that's what I hoped. Thank you!

@camdencheek camdencheek enabled auto-merge (squash) June 7, 2024 13:46
@camdencheek camdencheek merged commit 929258e into main Jun 7, 2024
@camdencheek camdencheek deleted the cc/integrate-sentry branch June 7, 2024 15:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants