Skip to main content

[Remix] How do I continue getting error logging to my console after integrating Sentry in my app?

Issue

Before I added Sentry to my Remix app, server errors logged to the console with console.error. After I integrated @sentry/remix, those errors still reach Sentry, but they no longer print to my server console.

Applies To

  • All SaaS Customers and Self-Hosted Users

  • @sentry/remix

  • handleError in entry.server.tsx

  • Error Monitoring

Resolution

Remix logs server errors with console.error only when you do not export a custom handleError. When you export handleError (including Sentry.sentryHandleError or a Sentry-wrapped handler), Remix turns off that default console logging. Sentry’s sentryHandleError reports the error to Sentry and does not call console.error.

To keep console logging and Sentry capture:

  1. Open app/entry.server.tsx (or entry.server.js).

  2. Wrap a custom handler with Sentry.wrapHandleErrorWithSentry.

  3. Call console.error in that handler (skip aborted requests).

import * as Sentry from "@sentry/remix";export const handleError = Sentry.wrapHandleErrorWithSentry(
  (error, { request }) => {
    if (!request.signal.aborted) {
      console.error(error);
    }
  },
);

If you currently export only Sentry.sentryHandleError, replace it with the wrapped handler above so you can add console logging.

Did this answer your question?