Source Maps

To enable readable stack traces in your Sentry errors, you need to upload your source maps to Sentry.

Upload Source Maps for a Remix Project

Sentry uses releases to match the correct source maps to your events. This page is a guide on how to create releases and upload source maps to Sentry when bundling your Remix app.

1. Generate Source Maps

To generate source maps with your Remix project, you need to call remix build with the --sourcemap option.

Please refer to the Remix CLI docs for more information.

2. Create a Release and Upload Source Maps

The Sentry Remix SDK provides a script to automatically create a release and upload source maps after you've built your project. Under the hood, it uses the Sentry CLI.

This script requires some configuration, which can either be done through a .sentryclirc file in the root of your project or through environment variables:

.sentryclirc
Copied
[auth]
token=your-auth-token

[defaults]
org=example-org
project=example-project

Next, run the upload script with the following command:

Copied
yarn sentry-upload-sourcemaps

# For usage details run
yarn sentry-upload-sourcemaps --help

3. Remove Remix Source Maps

Remix validly discourages the user from hosting source maps in production. After uploading the maps to Sentry, we suggest you delete the .map files. Here's a simple shell command example:

Copied
find ./public/build -type f -name '*.map' -delete
find ./build -type f -name '*.map' -delete

Please note that these commands might vary for the operating system or shell you use.

Additional Resources

Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").