Skip to main content
The @sentry/remix package provides comprehensive error tracking and performance monitoring for Remix applications, with support for both client and server environments.

Prerequisites

  • Node.js 18 or newer
  • Remix 2.x
  • React 18.x
  • A Sentry account and project DSN

Installation

1

Install the Package

Install @sentry/remix using your preferred package manager:
Current Version: 10.42.0
2

Initialize Client-Side

Create or update app/entry.client.tsx:
3

Initialize Server-Side

Create or update app/entry.server.tsx:
4

Wrap Root Component

Wrap your root component with withSentry in app/root.tsx:
5

Verify Installation

Create a test route to verify Sentry is working:
Visit the route and click the button. Check your Sentry dashboard to see the error.

Loaders and Actions

Loader Functions

Errors in loaders are automatically captured:

Action Functions

Error Boundaries

Create custom error boundaries with Sentry integration:

Performance Monitoring

Automatic Instrumentation

The SDK automatically creates spans for:
  • Page loads and navigation
  • Loaders and actions
  • Server requests
  • Database queries (with integrations)

Custom Spans

Database Integrations

Prisma

Then use Prisma normally:

MongoDB

Setting Context

User Context

Tags and Extra Context

Session Replay

Configure Session Replay in your client entry:

Source Maps

Sentry provides a CLI tool for uploading source maps:

Using the Upload Script

  1. Build your app with source maps:
  2. Upload source maps:

Automated with package.json

Using Sentry CLI Directly

For more control, use sentry-cli directly:

Cloudflare Workers

For Cloudflare Workers deployment:
Import from @sentry/remix/cloudflare instead of @sentry/remix for edge runtime support.

Advanced Configuration

Sampling

Environment Detection

Custom Transport

Troubleshooting

Errors Not Captured

  1. Ensure both entry.client.tsx and entry.server.tsx are configured
  2. Check that withSentry wraps your root component
  3. Verify DSN is correct in both client and server configs

Source Maps Not Working

  1. Ensure you’re building with --sourcemap flag
  2. Check that source maps are being uploaded correctly
  3. Verify release version matches between build and upload

Performance Data Missing

  1. Ensure tracesSampleRate is greater than 0
  2. Check that integrations are configured properly
  3. Verify Sentry is initialized before app runs
Make sure to call Sentry.init() in both entry.client.tsx and entry.server.tsx with appropriate configurations for each environment.

Next Steps