Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gatsby): Include app-* entrypoints as they may include user source code #5685

Merged
merged 1 commit into from
Sep 21, 2022

Conversation

Auspicus
Copy link
Contributor

@Auspicus Auspicus commented Sep 2, 2022

Before submitting a pull request, please take a look at our
Contributing guidelines and verify:

  • If you've added code that should be tested, please add tests.
  • Ensure your code lints and the test suite passes (yarn lint) & (yarn test).

TODO:

  • Add references to Gatsby source where this may occur

@Lms24
Copy link
Member

Lms24 commented Sep 2, 2022

Hi @Auspicus, thanks for opening up this PR. Before we approve and merge this, could you explain a little more what is in this app-* entry point? Any chance that we might miss source maps if we ignore it (i.e. don't upload source maps)?

@Auspicus
Copy link
Contributor Author

Auspicus commented Sep 2, 2022

@Lms24 The current codebase actually ignores the app-* entrypoint. I think previous versions of Gatsby (before v4) would only bundle core code in the app-* entrypoint but somewhere in v4 this changed. This has at least been what I have found from the few sites I've looked at. The change here removes app-* from the ignore list so its sourcemaps are included and uploaded to Sentry. I am following up with the Gatsby team to confirm this and will respond here once I know more.

@Lms24
Copy link
Member

Lms24 commented Sep 2, 2022

Right, I mixed this up. Thanks, for following up. Just ping any of us when you have an answer, then we'll give this PR another review. Cheers!

@Auspicus
Copy link
Contributor Author

Auspicus commented Sep 6, 2022

@Lms24 Here's a start I guess. I'm still trying to dig through the Webpack config to point to the exact places where this is happening but the docs explain that if a module is included in more than one chunk it may end up in commons-* or app-* implying that user code may end up in app-*.

EDIT: Here's the relevant Webpack config although it's hard to pinpoint a specific line that would dictate that app-* may contain user code.

EDIT2: There's also this blog post from Ben Robertson about the contents of the different chunks: https://ben.robertson.is/notes/gatsby-and-bundle-chunking

EDIT3: And Gatsby docs for more detailed explanation: https://www.gatsbyjs.com/docs/how-code-splitting-works/

@AbhiPrasad AbhiPrasad added the Package: gatsby Issues related to the Sentry Gatsby SDK label Sep 21, 2022
Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! Thanks for the PR. Let's merge this in, we can always revert if folks come back and give feedback.

@AbhiPrasad AbhiPrasad merged commit 874b09a into getsentry:master Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: gatsby Issues related to the Sentry Gatsby SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants