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:
Visit the auth token user settings page to find your auth tokens.
.sentryclirc
[auth]
token=your-auth-token
[defaults]
org=example-org
project=example-project
Next, run the upload script with the following command:
yarn sentry-upload-sourcemaps
# For usage details run
yarn sentry-upload-sourcemaps --help
For more advanced configuration, use sentry-cli
directly to upload source maps..
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:
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.
By default, if Sentry can't find the uploaded files it needs, it will attempt to download them from the URLs in the stack trace. To disable this, turn off "Enable JavaScript source fetching" in either your organization's "Security & Privacy" settings or your project's general settings.
Additional Resources
- Using sentry-cli to Upload Source Maps
- 4 Reasons Why Your Source Maps Are Broken
- Debug Your Node.js Projects with Source Maps
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").
- Package:
- npm:@sentry/remix
- Version:
- 7.51.0
- Repository:
- https://github.com/getsentry/sentry-javascript