Skip to content

Commit

Permalink
fix: Safeguard for Sentry default templates + nitpick (#9012)
Browse files Browse the repository at this point in the history
Co-authored-by: Tobbe Lundberg <[email protected]>
  • Loading branch information
HazAT and Tobbe committed Dec 21, 2023
1 parent 44e301b commit 753e17f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const handler = async ({ force }) => {
addWebPackages(['@sentry/react@7', '@sentry/browser@7']),
addEnvVarTask(
'SENTRY_DSN',
'https://[email protected]/XXXXXXX',
'',
'https://docs.sentry.io/product/sentry-basics/dsn-explainer/'
),
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { db as client } from 'src/lib/db'
Sentry.init({
dsn: process.env.SENTRY_DSN,
environment: process.env.NODE_ENV,
integrations: [new Sentry.Integrations.Prisma({ client })],
integrations: [
new Sentry.Integrations.Prisma({ client }),
new Sentry.Integrations.Http({ tracing: true }),
],
tracesSampleRate: 1.0,
})

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
import * as Sentry from '@sentry/react'

let dsn = ''
let environment = 'development'

if (typeof process === 'undefined' || !process.env?.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"
]

`)
console.error('Sentry is disabled for now')
} else {
dsn = process.env.SENTRY_DSN
environment = process.env.NODE_ENV
}

Sentry.init({
dsn: process.env.SENTRY_DSN,
environment: process.env.NODE_ENV,
dsn,
environment,
integrations: [new Sentry.BrowserTracing()],
tracesSampleRate: 1.0,
})
Expand Down

0 comments on commit 753e17f

Please sign in to comment.