Skip to content

React 19 hydration error ignoring #15886

@astrodomas

Description

@astrodomas

Environment

self-hosted (https://develop.sentry.dev/self-hosted/)

What are you trying to accomplish?

Hello,
I'm trying to ignore the react 418 error:

Hydration failed because the server rendered  didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:

- A server/client branch `if (typeof window !== 'undefined')`.
- Variable input such as `Date.now()` or `Math.random()` which changes each time it's called.
- Date formatting in a user's locale which doesn't match the server.
- External changing data without sending a snapshot of it along with the HTML.
- Invalid HTML tag nesting.

It can also happen if the client has a browser extension installed which messes with the HTML before React loaded.

https://react.dev/link/hydration-mismatch<redacted>

And sentry does not seem to ignore this error.

How are you getting stuck?

Using: "@sentry/nextjs": "^8.47.0"

tried to paste the following ignore strings + regexp matches inside sentry.client.config.ts:

  • "Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:\n\n- A server/client branch if (typeof window !== 'undefined').\n- Variable input such as Date.now()orMath.random() which changes each time it's called.\n- Date formatting in a user's locale which doesn't match the server.\n- External changing data without sending a snapshot of it along with the HTML.\n- Invalid HTML tag nesting.\n\nIt can also happen if the client has a browser extension installed which messes with the HTML before React loaded.\n\nhttps://react.dev/link/hydration-mismatch" NOTE: Copied the message title from react repo itself
  • /Error: Hydration failed because the server rendered HTML/i
  • Hydration failed because the server rendered HTML

Also, I had seen this issue that indicates that Sentry handles react errors behind the scenes and prints the title, however these ignorations also don't work:

  • https://reactjs.org/docs/error-decoder.html?invariant=418
  • https://react.dev/errors/418

Where in the product are you?

Issues

Link

No response

DSN

No response

Version

24.2.0

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    Status

    Waiting for: Community

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions