Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remix SDK not reporting server errors to Sentry #8216

Closed
3 tasks done
MoSattler opened this issue May 25, 2023 · 5 comments
Closed
3 tasks done

Remix SDK not reporting server errors to Sentry #8216

MoSattler opened this issue May 25, 2023 · 5 comments

Comments

@MoSattler
Copy link

MoSattler commented May 25, 2023

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/remix

SDK Version

7.53.1

Framework Version

Remix 1.16.1

Link to Sentry event

No response

SDK Setup

// entrypoint.client.ts
Sentry.init({
  debug: true,
  dsn: "XXX",
  integrations: [
    new Sentry.BrowserTracing({
      routingInstrumentation: Sentry.remixRouterInstrumentation(
        useEffect,
        useLocation,
        useMatches
      ),
    }),
    new Sentry.Replay(),
  ],
  // Performance Monitoring
  tracesSampleRate: 1.0, // Capture 100% of the transactions, reduce in production!
  // Session Replay
  replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
  replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
});
// entrypoint.server.ts
Sentry.init({
  debug: true,
  dsn: "XXX",
  integrations: [new Sentry.Integrations.Prisma({ client: prisma })],
  // Performance Monitoring
  tracesSampleRate: 1.0, // Capture 100% of the transactions, reduce in production!
});
// root
function App() {
  return (
    <html lang="en" className="h-full bg-gray-100">
      <head>
        <meta charSet="utf-8" />
        <meta name="viewport" content="width=device-width,initial-scale=1" />
        <Meta />
        <Links />
      </head>
      <body className="h-full">
        <IntlProvider locale={"en"}>
          <Outlet />
        </IntlProvider>
        <ScrollRestoration />
        <Scripts />
        <LiveReload />
      </body>
    </html>
  );
}

export default withSentry(App);

Steps to Reproduce

  1. Clone this repo
  2. Remove try catch here so you get the equivalent of the docs here:
export const action: ActionFunction = async ({ request }) => {
  throw new Error("Sentry Error");
};
  1. trigger action

When turning on debug, it will also give out

Sentry Logger [warn]: Remix SDK was unable to wrap your root because of one or more missing parameters.

Expected Result

Unhandled error that breaks actions or loaders should be reported to sentry

Actual Result

Nothing is reported to sentry

@Lms24
Copy link
Member

Lms24 commented May 26, 2023

Hi @MoSattler thanks for writing in and thanks for the detailed information!

Sentry Logger [warn]: Remix SDK was unable to wrap your root because of one or more missing parameters.

Hmm looks like something weird is going on. I can see that you're passing the three hooks needed to the routing instrumentation. but one of the 4 params required here,

https://github.com/getsentry/sentry-javascript/blob/9b875b114d285ae997d97b7093a9b5804b802fc1/packages/remix/src/performance/client.tsx#L102-L110

is missing. Maybe something funky happens to _customStartTransaction, not sure...

I'm not sure if this is related to the error not being caught, though.

We'll have to take a closer look at this but at the moment we're very busy with other issues (🔥 🚒 ). I'll backlog this with high prio so that we take a look at it soon.

@Lms24
Copy link
Member

Lms24 commented May 26, 2023

possibly related: #8200

@MoSattler
Copy link
Author

Thank you @Lms24!

Let me know if you need anything else from you side.

@onurtemizkan
Copy link
Collaborator

Hi @MoSattler, thanks for the issue report!

Sentry Logger [warn]: Remix SDK was unable to wrap your root because of one or more missing parameters.

This log is misleading and should not be on the server-side, so I opened a PR to fix it. (#8269)


I could not reproduce the bug locally, with the steps you mentioned in the report.

To trigger the action I used:

curl -X PUT http://localhost:3000\?index

And can see the thrown error from the action function is reported to Sentry.

Is there a specific setup or deployment target where you are seeing this issue?

@MoSattler
Copy link
Author

Hi @onurtemizkan - I can reproduce it in 7.53.1, but it seems fixed in 7.54.0. I guess it was related to #8265.

Thank you for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants