Skip to content

Sentry.wrapRemixHandleError missing request information #10002

Closed

Description

@clovis1122

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.91.0

Framework Version

2.4.1

Link to Sentry event

https://recruitercom.sentry.io/issues/4787393394/?project=4504806528253952&query=is%3Aunresolved&referrer=issue-stream&statsPeriod=24h&stream_index=0

SDK Setup

No response

Steps to Reproduce

  1. Throw an error inside a loader function

Expected Result

Sentry log the error with request information

Actual Result

Sentry is logging the error without request information.

Activity

  1. moved this to Waiting for: Product Owner in GitHub Issues with 👀 2on Jan 1, 2024
  2. clovis1122 commented on Jan 1, 2024

    @clovis1122
    Author

    I spent some time debugging this locally and think it may be related to this code:

    const getInternalSymbols = (
    request: Record<string, unknown>,
    ): {
    bodyInternalsSymbol: string;
    requestInternalsSymbol: string;
    } => {
    const symbols = Object.getOwnPropertySymbols(request);
    return {
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    bodyInternalsSymbol: symbols.find(symbol => symbol.toString().includes('Body internals')) as any,
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    requestInternalsSymbol: symbols.find(symbol => symbol.toString().includes('Request internals')) as any,
    };
    };

    I do not see any of these internals defined as I debug this, so this function always returns undefined symbols and Remix fails to normalize the request:

    image

    I wonder why Sentry needs to do this conversion instead of reading the standard Request directly to get the information as needed?

  3. self-assigned this
    on Jan 1, 2024
  4. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 2on Jan 2, 2024
  5. onurtemizkan commented on Jan 2, 2024

    @onurtemizkan
    Contributor

    Hi @clovis1122, thanks for reporting.

    I have tried to reproduce this locally with the latest SDK and Remix 2.4.1 and did not see any problems with the request data getting attached.

    I wonder why Sentry needs to do this conversion instead of reading the standard Request directly to get the information as needed?

    We are replicating the behaviour of Remix (web-fetch) while extracting information from requests for consistency.

    Could you please provide us a reproduction so we can debug it further?

  6. moved this to Waiting for: Community in GitHub Issues with 👀 2on Jan 2, 2024
  7. clovis1122 commented on Jan 14, 2024

    @clovis1122
    Author

    @onurtemizkan I took a second look at this. It seems the code relies on Remix's polyfill for NodeJS's fetch API. The internals like bodyInternalsSymbol and requestInternalsSymbol are available upon installing Remix's polyfill, like so:

    import { installGlobals } from "@remix-run/node";
    installGlobals();
    

    However, this polyfill should not be needed, starting on NodeJS v18 which includes the Fetch API enabled by default. I do not use it in my app (which runs on Node v20). Sentry should not read Remix internals either. A backward-compatible, future-proof solution is to read from the standard request directly.

    export const normalizeRemixRequest = (request: RemixRequest): Record<string, any> => {

    This implementation can be modified to read from request using the standard interface. The request's URL is available via request.url. The header are available via request.headers.

  8. moved this from Waiting for: Community to Waiting for: Product Owner in GitHub Issues with 👀 2on Jan 14, 2024
  9. onurtemizkan commented on Jan 14, 2024

    @onurtemizkan
    Contributor

    @clovis1122, I opened a PR which adds support for non-polyfilled fetch request objects. #10166
    Which will hopefully resolve this issue.

    Thanks again for reporting.

  10. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 2on Jan 14, 2024
  11. ghost added on Aug 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions