Skip to content

Conversation

@kasperpeulen
Copy link
Contributor

@kasperpeulen kasperpeulen commented Dec 21, 2025

This PR updates Sentry, and I used the Sentry Wizard to configure the app for the latest best practices.

image
  • This also makes sure that you can see if, and on which environment a release was deployed:
image
  • The SENTRY_ENVIRONMENT variable is passed to the production/staging fly app, so that you can filter for staging or production errors/traces in sentry. This variable is set to SENTRY_ENVIRONMENT=test in playwright. So that you can also debug sentry errors that occur in CI.

  • It adds Sentry.getMetaTagTransformer for distrubuted tracing between frontend and backend! 🔥

image
  • It enables spotlight in local development. In local development, errors are not send to Sentry server, but to the local Sentry spotlight app (if installed). This is useful for local debugging, but maybe even more important, this unlocks a lot of AI/MCP potential. If you install the Sentry MCP server, then this makes errors, network requests, db queries, logs, traces directly available to your agent.

  • I added the Sentry logging integration, as the epic stack has no logging solutions, and having logs next your error tool, can add a lot of context to why errors happened. And gives more context on what is actually going on the server:

image
  • Removed unstable_sentryVitePluginOptions as this is not needed anymore with the react router vite sentry plugin. It deletes sourcemaps automatically.

  • I added a sentry example page (only available to admin users). So that users can easily test sentry errors in the deployed app.

Test Plan

I have tested all this locally and by deploying it myself.

Checklist

  • Tests updated
  • Docs updated

Screenshots

@kasperpeulen kasperpeulen changed the title Kasper/sentry Update sentry Dec 21, 2025
@kasperpeulen kasperpeulen force-pushed the kasper/sentry branch 2 times, most recently from 4033fa2 to 8a1be9f Compare December 21, 2025 18:34
@kasperpeulen kasperpeulen marked this pull request as ready for review December 21, 2025 23:08
Copilot AI review requested due to automatic review settings December 21, 2025 23:08
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates Sentry from v9 to v10 and modernizes the instrumentation approach by using the recommended node --import pattern for ESM projects. The update enables several new features including Spotlight for local development, distributed tracing between frontend and backend, console logging integration, and automated Sentry release creation via GitHub Actions.

Key Changes

  • Migrates Sentry packages from v9.32.0 to v10.31.0
  • Implements early instrumentation using --import flag in package.json scripts
  • Adds new instrument.server.ts file for centralized server-side Sentry configuration
  • Integrates Spotlight for local debugging and removes production-only Sentry initialization checks
  • Enables distributed tracing with Sentry.getMetaTagTransformer() for client-server trace correlation

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
package.json Updates Sentry packages to v10.31.0, adds @sentry/cli v3.0.1, and modifies scripts to use --import ./instrument.server.ts for early instrumentation
package-lock.json Reflects dependency updates including Sentry v10 and updated OpenTelemetry instrumentation packages
instrument.server.ts New file containing server-side Sentry initialization with Prisma, HTTP, profiling, and console logging integrations
vite.config.ts Simplifies Sentry config by removing unstable_sentryVitePluginOptions and using new plugin configuration
server/index.ts Removes manual Sentry initialization logic (moved to instrument.server.ts via --import)
server/utils/monitoring.ts Deleted - functionality moved to instrument.server.ts
app/entry.server.tsx Adds Sentry wrapper functions for request handling and error tracking, implements meta tag transformer for distributed tracing, and updates CSP for Spotlight
app/entry.client.tsx Moves Sentry initialization inline with Spotlight support and updates integrations for v10
app/utils/monitoring.client.tsx Deleted - functionality moved to app/entry.client.tsx
.github/workflows/deploy.yml Injects SENTRY_ENVIRONMENT and adds Sentry release creation step using getsentry/action-release@v3
.env.example Adds SENTRY_ENVIRONMENT variable for environment-specific configuration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kasperpeulen kasperpeulen marked this pull request as draft December 22, 2025 12:21
@kasperpeulen kasperpeulen marked this pull request as ready for review December 22, 2025 17:56
@kasperpeulen
Copy link
Contributor Author

The environment variables are all over the place in this PR.
I would like to clean this all up, in a following PR, if we choose to adopt this proposal:
#1069

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant