@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 Current Version: 10.42.0
@sentry/remix using your preferred package manager: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
MongoDB
Setting Context
User Context
Tags and Extra Context
Breadcrumbs
Session Replay
Configure Session Replay in your client entry:Source Maps
Sentry provides a CLI tool for uploading source maps:Using the Upload Script
-
Build your app with source maps:
-
Upload source maps:
Automated with package.json
Using Sentry CLI Directly
For more control, usesentry-cli directly:
Cloudflare Workers
For Cloudflare Workers deployment:@sentry/remix/cloudflare instead of @sentry/remix for edge runtime support.
Advanced Configuration
Sampling
Environment Detection
Custom Transport
Troubleshooting
Errors Not Captured
- Ensure both
entry.client.tsxandentry.server.tsxare configured - Check that
withSentrywraps your root component - Verify DSN is correct in both client and server configs
Source Maps Not Working
- Ensure you’re building with
--sourcemapflag - Check that source maps are being uploaded correctly
- Verify release version matches between build and upload
Performance Data Missing
- Ensure
tracesSampleRateis greater than 0 - Check that integrations are configured properly
- Verify Sentry is initialized before app runs
Next Steps
- Configure Error Boundaries
- Set up Session Replay
- Learn about Performance Monitoring
- Explore Database Integrations