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

wrapHandleErrorWithSentry documentation is incorrect #12785

Closed
3 tasks done
dmarkow opened this issue Jul 5, 2024 · 1 comment · Fixed by getsentry/sentry-wizard#621
Closed
3 tasks done

wrapHandleErrorWithSentry documentation is incorrect #12785

dmarkow opened this issue Jul 5, 2024 · 1 comment · Fixed by getsentry/sentry-wizard#621
Assignees
Labels
Package: remix Issues related to the Sentry Remix SDK Type: Bug

Comments

@dmarkow
Copy link

dmarkow commented Jul 5, 2024

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.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Jul 5, 2024
@github-actions github-actions bot added the Package: remix Issues related to the Sentry Remix SDK label Jul 5, 2024
@s1gr1d
Copy link
Member

s1gr1d commented Jul 8, 2024

This is indeed correct, thanks for reporting this! 🙌🏻
Our migration docs in the JS repository actually show a correct implementation. I will change it accordingly in the docs and in the wizard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: remix Issues related to the Sentry Remix SDK Type: Bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants