You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In nextjs, all non-API pages (other than sometimes `_error`) include the `_app` component. Up until now, we've leveraged this fact when deciding which webpack entrypoints should have `sentry.server.config.js` injected during serverside build; specifically, we inject into `_app`, `_error`, and all API handlers, but not any other non-API pages.
This works fine, but it means that if we want to be able to pick and choose _which_ non-API pages get the config file injected, we're out of luck. Either we inject into `_app` (and therefore all non-API pages) or we don't (and therefore no non-API pages). In order to allow selective injection (which will be included in an upcoming PR), this inverts the logic: instead of `_app` being the only non-API page into which we inject, it is now one of the only pages we _don't_ inject into. (The other is `_document`, which plays a similar role as `_app` does.) Given that `_app` and `_document` can't stand on their own (without the context of a page component inside of them), they don't need to have Sentry injected separately. Having it injected into the pages `_app` and `_document` wrap is sufficient.
(Note that this change only applies to serverside injection. Client-side, we still only inject into `_app`, as we can't be selective about which pages get instrumented on the front end given all of the global monkeypatching we do.)
0 commit comments