-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: restore form; add throw error button
- Loading branch information
Showing
3 changed files
with
36 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,35 @@ | ||
import * as Sentry from '@sentry/react' | ||
|
||
let dsn = '' | ||
let environment = 'development' | ||
function main() { | ||
const SENTRY_DSN = | ||
process.env.SENTRY_DSN || | ||
// HACK: Redwood+Netlify doesn't seem to be obeying our `includeEnvironmentVariables` setting | ||
process.env.REDWOOD_ENV_SENTRY_DSN | ||
|
||
// HACK: I think this helps the build rewrite find the env var | ||
const SENTRY_DSN = process.env.SENTRY_DSN || process.env.REDWOOD_ENV_SENTRY_DSN | ||
if (!SENTRY_DSN) { | ||
console.error( | ||
'Missing SENTRY_DSN environment variable. Sentry is disabled for now.' | ||
) | ||
return | ||
} | ||
|
||
console.log({ SENTRY_DSN, env: process.env }) | ||
const dsn = SENTRY_DSN | ||
const environment = process.env.NODE_ENV | ||
|
||
if (typeof process === 'undefined' || !SENTRY_DSN) { | ||
console.error( | ||
'Missing SENTRY_DSN environment variable. Did you forget to add it to ' + | ||
'your redwood.toml file in `includeEnvironmentVariables`?' | ||
) | ||
console.info(`Copy this into your redwood.toml file:`) | ||
console.info(` | ||
includeEnvironmentVariables = [ | ||
"SENTRY_DSN" | ||
] | ||
Sentry.init({ | ||
dsn, | ||
environment, | ||
integrations: [new Sentry.BrowserTracing()], | ||
tracesSampleRate: 1.0, | ||
}) | ||
|
||
`) | ||
console.error('Sentry is disabled for now') | ||
} else { | ||
dsn = SENTRY_DSN | ||
environment = process.env.NODE_ENV | ||
console.log('Sentry initialized', { | ||
dsn, | ||
environment, | ||
processEnv: process.env, | ||
}) | ||
} | ||
|
||
Sentry.init({ | ||
dsn, | ||
environment, | ||
integrations: [new Sentry.BrowserTracing()], | ||
tracesSampleRate: 1.0, | ||
}) | ||
main() | ||
|
||
export default Sentry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters