-
Notifications
You must be signed in to change notification settings - Fork 1k
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
fix: Safeguard for Sentry default templates + nitpick #9012
Conversation
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.
Hey @HazAT, yeah we could do with a better error, the "process is undefined" one leaves a lot to be desired. Left a comment on the conditional, let me know what you think. Thanks!
let dsn = '' | ||
let environment = 'development' | ||
|
||
if (typeof process === 'undefined' || !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.
The way Vite works (on Redwood v6), it replaces whole "property access" chains (I'm not sure what the word is), like process.env.SENTRY_DSN
. The process object doesn't really exist. So I think process
will always be undefined. Anyway, the upshot is that it's probably better to just check the second one:
if (typeof process === 'undefined' || !process.env.SENTRY_DSN) { | |
if (!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.
I tried it just with just the second condition but it still throws Uncaught ReferenceError: process is not defined
tbf I only tested in dev and not a prod build.
Co-authored-by: Tobbe Lundberg <[email protected]>
Hey,

I added a small safeguard to not break the frontend once a user added Sentry.
process
is undefined if a user doesn't add it toredwood.toml
, and it results in the default rendering a blank page.Before
This fix adds a safeguard and some barebone instructions on what a user has to do.

After
@sentry/tracing
imports; We recently deprecated the need to import it from there separatelyhttps://[email protected]/XXXXXXX
to''
(empty string) because the other one might result in an error