-
Notifications
You must be signed in to change notification settings - Fork 0
Kasper/sentry fork #29
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -231,13 +231,23 @@ jobs: | |||||||||
| --regions $FLY_REGION \ | ||||||||||
| --vm-size shared-cpu-1x \ | ||||||||||
| --env APP_ENV=staging \ | ||||||||||
| --env SENTRY_ENVIRONMENT=staging \ | ||||||||||
| --env ALLOW_INDEXING=false \ | ||||||||||
| --app $FLY_APP_NAME \ | ||||||||||
| --image-label ${{ github.sha }} \ | ||||||||||
| --build-arg COMMIT_SHA=${{ github.sha }} \ | ||||||||||
| --build-secret SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} \ | ||||||||||
|
|
||||||||||
| echo "url=https://$FLY_APP_NAME.fly.dev" >> $GITHUB_OUTPUT | ||||||||||
| - name: Create Sentry release | ||||||||||
| env: | ||||||||||
| SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | ||||||||||
| SENTRY_ORG: kasper-peulen-d2924a93 | ||||||||||
| SENTRY_PROJECT: epic-rsc-stack | ||||||||||
|
Comment on lines
+245
to
+246
|
||||||||||
| SENTRY_ORG: kasper-peulen-d2924a93 | |
| SENTRY_PROJECT: epic-rsc-stack | |
| SENTRY_ORG: ${{ vars.SENTRY_ORG }} | |
| SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }} |
Copilot
AI
Dec 29, 2025
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 Sentry organization and project identifiers are hardcoded in the production deployment step. These should be extracted to GitHub repository variables or secrets to make this workflow reusable across different projects and prevent accidental deployments to the wrong Sentry project.
| SENTRY_ORG: kasper-peulen-d2924a93 | |
| SENTRY_PROJECT: epic-rsc-stack | |
| SENTRY_ORG: ${{ vars.SENTRY_ORG }} | |
| SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,44 @@ | ||
| import * as Sentry from '@sentry/react-router' | ||
| import { startTransition } from 'react' | ||
| import { hydrateRoot } from 'react-dom/client' | ||
| import { HydratedRouter } from 'react-router/dom' | ||
|
|
||
| if (ENV.MODE === 'production' && ENV.SENTRY_DSN) { | ||
| void import('./utils/monitoring.client.tsx').then(({ init }) => init()) | ||
| } | ||
| Sentry.init({ | ||
| // Sentry will only send requests if SENTRY_DSN is defined | ||
| dsn: ENV.MODE === 'production' ? ENV.SENTRY_DSN : undefined, | ||
| // See https://spotlightjs.com/ for how to install the Spotlight Desktop app for local development | ||
| spotlight: ENV.MODE === 'development', | ||
| environment: ENV.MODE, | ||
| beforeSend(event) { | ||
| if (event.request?.url) { | ||
| const url = new URL(event.request.url) | ||
| if ( | ||
| url.protocol === 'chrome-extension:' || | ||
| url.protocol === 'moz-extension:' | ||
| ) { | ||
| // This error is from a browser extension, ignore it | ||
| return null | ||
| } | ||
| } | ||
| return event | ||
| }, | ||
| integrations: [ | ||
| Sentry.reactRouterTracingIntegration(), | ||
| Sentry.replayIntegration(), | ||
| ], | ||
|
Comment on lines
+25
to
+28
|
||
|
|
||
| // Set tracesSampleRate to 1.0 to capture 100% | ||
| // of transactions for performance monitoring. | ||
| // We recommend adjusting this value in production | ||
| tracesSampleRate: 1.0, | ||
|
|
||
| // Capture Replay for 10% of all sessions, | ||
| // plus for 100% of sessions with an error | ||
| replaysSessionSampleRate: 0.1, | ||
| replaysOnErrorSampleRate: 1.0, | ||
|
|
||
| enableLogs: true, | ||
| }) | ||
|
|
||
| startTransition(() => { | ||
| hydrateRoot(document, <HydratedRouter />) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import * as Sentry from '@sentry/react-router' | ||
| import { requireUserWithRole } from '../../utils/permissions.server.ts' | ||
| import { type Route } from './+types/api.sentry-example-api.ts' | ||
|
|
||
| class SentryExampleBackendError extends Error { | ||
| constructor(message: string | undefined) { | ||
| super(message) | ||
| this.name = 'SentryExampleBackendError' | ||
| } | ||
| } | ||
|
|
||
| export async function loader({ request }: Route.LoaderArgs) { | ||
| await requireUserWithRole(request, 'admin') | ||
|
|
||
| await Sentry.startSpan( | ||
| { | ||
| name: 'Example Backend Span', | ||
| op: 'test', | ||
| }, | ||
| async () => { | ||
| // Simulate some backend work | ||
| await new Promise((resolve) => setTimeout(resolve, 100)) | ||
| }, | ||
| ) | ||
|
|
||
| throw new SentryExampleBackendError( | ||
| 'This error is raised on the backend API route.', | ||
| ) | ||
| } | ||
|
Comment on lines
+1
to
+29
|
||
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 Sentry DSN is exposed in the .env.example file. This appears to be a real DSN token that could be used to send data to your Sentry project. Even for example files, it's better to use a placeholder value to prevent accidental usage of production/test credentials.