Remix

Sentry's Remix SDK relies on our React SDK for the frontend and Node SDK for the backend. That means all features available in those SDKs are also available in this SDK.

On this page, we get you up and running with Sentry's SDK.

If you're seeing deprecation warnings in your code, please note that we're currently working on version 8 of the JavaScript SDKs. In v8, some methods and properties will be removed or renamed. Check out the Migration docs and learn how to update your code to be compatible with v8.

Don't already have an account and Sentry project established? Head over to sentry.io, then return to this page.

Sentry captures data by using an SDK within your application’s runtime.

We recommend installing the SDK through our installation wizard:

Copied
npx @sentry/wizard@latest -i remix

The wizard will prompt you to log in to Sentry. It will then automatically do the following steps for you:

  • create two files in the root directory of your project, entry.client.tsx and entry.server.tsx (if they don't already exist).
  • add the default Sentry.init() for the client in entry.client.tsx and the server in entry.server.tsx.
  • create .sentryclirc with an auth token to upload source maps (this file is automatically added to .gitignore).
  • adjust your build script in package.json to automatically upload source maps to Sentry when you build your application.
  • add an example page to your app to verify your Sentry setup

If you use Remix future flags, the wizard will instrument your application accordingly to support Remix v2 features.

After the wizard setup is completed, the SDK will automatically capture unhandled errors, and monitor performance. You can also manually capture errors.

Configuration should happen as early as possible in your application's lifecycle.

To complete your configuration, add options to your Sentry.init() calls. Here, you'll also be able to set context data, which includes data about the user, tags, or even arbitrary data, all of which will be added to every event sent to Sentry.

By default, Remix will minify your JavaScript and CSS files in production. This makes it difficult to debug errors in production. To make debugging easier, you can generate source maps and upload them to Sentry.

Depending on your build setup, you can either use Sentry's Vite plugin or sentry-upload-sourcemaps script to upload sourcemaps.

Please refer to the Sourcemaps Documentation, for more information.

For more advanced configuration, you can use sentry-cli directly to upload sourcemaps.

This snippet includes an intentional error, so you can test that everything is working as soon as you set it up.

routes/error.tsx
Copied
<button
  type="button"
  onClick={() => {
    throw new Error("Sentry Frontend Error");
  }}
>
  Throw error
</button>

This snippet adds a button that throws an error in a component or page.

Then, throw an error in a loader or action.

routes/error.tsx
Copied
export const action: ActionFunction = async ({ request }) => {
  throw new Error("Sentry Error");
};

To view and resolve the recorded error, log into sentry.io and open your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved.

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