Skip to content

wrapHandleErrorWithSentry documentation is incorrect #12785

@dmarkow

Description

@dmarkow

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

8.15.0

Framework Version

Remix 2.10.2

Link to Sentry event

No response

SDK Setup/Reproduction Example

No response

Steps to Reproduce

I noticed recently some users were reporting errors that weren't showing up in Sentry. I dug into our server handling code and it was from a recent update we made with the Sentry config.

https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/#server-side-errors

I updated our Remix integration using the documentation for server side errors:

import { wrapHandleErrorWithSentry } from "@sentry/remix";

export const handleError = wrapHandleErrorWithSentry;

The problem is, wrapHandleErrorWithSentry is a function that returns a function, meant to wrap your own custom error handler. If you call it as described, the function isn't getting called. So when Remix triggers an error, it calls the wrapper only. All that does it return a function, but doesn't actually call that function. So the errors never get reported.

If I change it to:

export const handleError = wrapHandleErrorWithSentry(() => {})

It works as expected. I also tried running npx @sentry/wizard@latest -i remix, which doesn't actually use the wrapHandleErrorWithSentry approach that the documentation recommends. Instead, it just inserts its own handleError function that doesn't exactly match what wrapHandleErrorWithSentry does internally.

Expected Result

It's ultimately my mistake for not testing server-side reporting after making a configuration change, but I would expect a working error handler when I following the documentation exactly. Documentation should mention that wrapHandleErrorWithSentry is a function that must be called to return a working error handler, e.g.:

export const handleError = wrapHandleErrorWithSentry(() => {
  // Custom handling code...
});

Actual Result

Server side errors are not reported.

Metadata

Metadata

Assignees

Labels

Package: remixIssues related to the Sentry Remix SDK

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions