Skip to content

Sentry does not detect global-error.js if it's in a dynamic route. #16765

Open
@harrisrobin

Description

@harrisrobin

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/browser

SDK Version

9.32.0

Framework Version

next 15

Link to Sentry event

No response

Reproduction Example/SDK Setup

No response

Steps to Reproduce

Nest your global-error.js within a dynamic route.

E.g:

    └── app
        └── [locale]
            ├── global-error.js

Expected Result

If you use something like next-intl the recommendation is to nest global-error.js inside [locale] so that it can get translated as well.

Unfortunately, when doing so Sentry SDK does not seem to detect it and outputs this warning:

web:build: warn  - It seems like you don't have a global error handler set up. It is recommended that you add a global-error.js file with Sentry instrumentation so that React rendering errors are reported to Sentry. 
Read more: https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#react-render-errors-in-app-router (you can suppress this warning by setting SENTRY_SUPPRESS_GLOBAL_ERROR_HANDLER_FILE_WARNING=1 as environment variable)
--
<br class="Apple-interchange-newline">

I expect sentry SDK to detect that global-error.js exists and not give me a warning.

Actual Result

web:build: warn  - It seems like you don't have a global error handler set up. It is recommended that you add a global-error.js file with Sentry instrumentation so that React rendering errors are reported to Sentry. Read more: https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#react-render-errors-in-app-router (you can suppress this warning by setting SENTRY_SUPPRESS_GLOBAL_ERROR_HANDLER_FILE_WARNING=1 as environment variable)
--
 ```

<br class="Apple-interchange-newline">

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Waiting for: Community

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions