ref(nextjs): Invert serverside injection criteria#6206
Merged
lobsterkatie merged 2 commits intomasterfrom Nov 15, 2022
Merged
Conversation
Contributor
size-limit report 📦
|
78dc8b8 to
c98a180
Compare
lforst
approved these changes
Nov 15, 2022
5d5d1e9 to
58afac0
Compare
d04f3bc to
054796b
Compare
Base automatically changed from
kmclb-add-stringMatchesSomePattern-helper
to
master
November 15, 2022 15:12
054796b to
3eeff43
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In nextjs, all non-API pages (other than sometimes
_error) include the_appcomponent. Up until now, we've leveraged this fact when deciding which webpack entrypoints should havesentry.server.config.jsinjected 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_appbeing 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_appdoes.) Given that_appand_documentcan'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_appand_documentwrap 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.)