René's URL Explorer Experiment


Title: fix(nextjs): Stop `SentryWebpackPlugin` from uploading unnecessary files by lobsterkatie · Pull Request #3845 · getsentry/sentry-javascript · GitHub

Open Graph Title: fix(nextjs): Stop `SentryWebpackPlugin` from uploading unnecessary files by lobsterkatie · Pull Request #3845 · getsentry/sentry-javascript

X Title: fix(nextjs): Stop `SentryWebpackPlugin` from uploading unnecessary files by lobsterkatie · Pull Request #3845 · getsentry/sentry-javascript

Description: Though sourcemap uploading using SentryWebpackPlugin is generally quite fast, even when there are a lot of files, there are situations in which it can slow things down a lot. There are a number of reasons for that, but one of them is that, in the current state, @sentry/nextjs's use of the plugin is pretty indiscriminate - it just uploads anything and everything in the .next folder (which is where nextjs puts all of its built files), during both client and server builds. The lack of specificity leads us to upload files we don't need, and the fact that we don't distinguish between client and server builds means that whichever one happens second not only uploads its own unnecessary files, it also uploads all of the files from the other build (which have already been uploaded), both necessary and unnecessary. More details here. This PR makes it so that we're much more specific in terms of what we upload, in order to fix both the specificity and the duplication problems. Notes: There's discussion in the linked issue about which non-user sources/maps to upload (things like code from webpack, nextjs itself, etc). In the end, I chose to restrict it to user code (almost - see below), for two reasons. First, non-user code is unlikely to change much (or often) between releases, so if third-party code were included, we'd be uploading lots and lots of copies of the same files. Second, though it's occasionally helpful to be able to see such code in the stacktrace, the vast majority of the time the problem lies in user code. For both reasons, then, including third-party files didn't feel worth it , either in terms of time spent uploading them or space spent storing them. (I say it's "almost" restricted to user code because, among other files, the server build generates bundles which are labeled only by numbers (1226.js and such), some of which are user code and some of which are third-party code, and - in this PR at least - I didn't include a way to filter out the latter while making sure to still include the former. This is potentially still a worthwhile thing to do, but the fact that it would mean actually examining the contents of files (rather than just their paths) makes it a more complicated change, which will have to wait for a future PR.) In that issue, the topic of HMR (hot module reloading) files also came up. For the moment I also chose to skip those (even though they contain user code), as a) the plugin isn't meant for use in a dev environment, where every change triggers a new build, potentially leading to hundreds of sets of release files being uploaded, and b) we'd face a similar issue of needing to examine more than just the path in order to know what to upload (to avoid uploading all previous iterations of the code at each rebuild). Another small issue I fixed, while I was in the relevant code, was to prevent the webpack plugin from injecting the release into bundles which don't need it (like third-party code, or any bundle with no Sentry.init() call). Since this lines up exactly with the files into which we need to inject sentry.server.config.js or sentry.client.config.js, I pulled it out into a function, shouldAddSentryToEntryPoint(). Fixes #3769 Fixes vercel/next.js#26588

Open Graph Description: Though sourcemap uploading using SentryWebpackPlugin is generally quite fast, even when there are a lot of files, there are situations in which it can slow things down a lot. There are a number of ...

X Description: Though sourcemap uploading using SentryWebpackPlugin is generally quite fast, even when there are a lot of files, there are situations in which it can slow things down a lot. There are a number of ...

Opengraph URL: https://github.com/getsentry/sentry-javascript/pull/3845

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.113.3

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:494ab35b-b011-ec8e-bfe5-84e9e8f0d107
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idC0F8:39AB0:13D667:1B977D:6B057021
html-safe-nonce72be86df4117aad0cf914a119d192cab4059c7e3745f60818c2e498413ec710e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMEY4OjM5QUIwOjEzRDY2NzoxQjk3N0Q6NkIwNTcwMjEiLCJ2aXNpdG9yX2lkIjoiNjM3NDI2MjcyNjQ0OTI2MjYyNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac9cec319b8e104b0c3a534d094473f49ce8763bea5c0f4537416605aff0e65008
hovercard-subject-tagpull_request:697954447
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/getsentry/sentry-javascript/pull/3845/files
twitter:imagehttps://avatars.githubusercontent.com/u/14812505?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/14812505?s=400&v=4
og:image:altThough sourcemap uploading using SentryWebpackPlugin is generally quite fast, even when there are a lot of files, there are situations in which it can slow things down a lot. There are a number of ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None507b2d62524c0f595c35a2a2ee8a6ec54b119f245b3c59eaa070013b70ed1ada
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git
octolytics-dimension-user_id1396951
octolytics-dimension-user_logingetsentry
octolytics-dimension-repository_id3328572
octolytics-dimension-repository_nwogetsentry/sentry-javascript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id3328572
octolytics-dimension-repository_network_root_nwogetsentry/sentry-javascript
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasee7a883ae3b439b8952652eaa7803e2587f30e339
ui-targetcanary-1
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/getsentry/sentry-javascript/pull/3845/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-javascript%2Fpull%2F3845%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-javascript%2Fpull%2F3845%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=getsentry%2Fsentry-javascript
Reloadhttps://github.com/getsentry/sentry-javascript/pull/3845/files
Reloadhttps://github.com/getsentry/sentry-javascript/pull/3845/files
Reloadhttps://github.com/getsentry/sentry-javascript/pull/3845/files
getsentryhttps://github.com/getsentry
sentry-javascripthttps://github.com/getsentry/sentry-javascript
Codehttps://github.com/getsentry/sentry-javascript
Issues334 (334)https://github.com/getsentry/sentry-javascript/issues
Pull requests54 (54)https://github.com/getsentry/sentry-javascript/pulls
Discussionshttps://github.com/getsentry/sentry-javascript/discussions
Actionshttps://github.com/getsentry/sentry-javascript/actions
Security and quality7 (7)https://github.com/getsentry/sentry-javascript/security
Insightshttps://github.com/getsentry/sentry-javascript/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fgetsentry%2Fsentry-javascript%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fgetsentry%2Fsentry-javascript%2Fissues%2Fnew%2Fchoose
lobsterkatiehttps://github.com/lobsterkatie
masterhttps://github.com/getsentry/sentry-javascript/tree/master
kmclb-nextjs-stop-uploading-too-much-stuffhttps://github.com/getsentry/sentry-javascript/tree/kmclb-nextjs-stop-uploading-too-much-stuff
Conversation 16 https://github.com/getsentry/sentry-javascript/pull/3845
Commits 7 https://github.com/getsentry/sentry-javascript/pull/3845/commits
Checks 0 https://github.com/getsentry/sentry-javascript/pull/3845/checks
Files changed https://github.com/getsentry/sentry-javascript/pull/3845/files
Please reload this pagehttps://github.com/getsentry/sentry-javascript/pull/3845/files
fix(nextjs): Stop SentryWebpackPlugin from uploading unnecessary files https://github.com/getsentry/sentry-javascript/pull/3845/files#top
Show all changes 7 commits https://github.com/getsentry/sentry-javascript/pull/3845/files
9231276 pull filter for entry points into a separate function lobsterkatie Jul 27, 2021 https://github.com/getsentry/sentry-javascript/pull/3845/commits/9231276919a885e9d3d6b85505b119da428b471b
a836639 pass defaults to override check as an argument lobsterkatie Jul 27, 2021 https://github.com/getsentry/sentry-javascript/pull/3845/commits/a836639c5750f344ba8d9fc152ab7e72de43126a
6101800 update webpack-plugin dependency lobsterkatie Jul 30, 2021 https://github.com/getsentry/sentry-javascript/pull/3845/commits/61018004e615a86a746b2477e2a8db574191343f
cffcefa create function to calculate default plugin options and merge them wi… lobsterkatie Jul 27, 2021 https://github.com/getsentry/sentry-javascript/pull/3845/commits/cffcefa87f1dda5da4d01814077e220c082d24c2
729dfff add config to BuildContext type and corresponding mock data lobsterkatie Jul 27, 2021 https://github.com/getsentry/sentry-javascript/pull/3845/commits/729dfff8a90c54bb349172d455a8716daeb6adb4
34654f1 distinguish between serverless and non-serverless builds lobsterkatie Aug 5, 2021 https://github.com/getsentry/sentry-javascript/pull/3845/commits/34654f19ac500da2f9ab634d9d8e8577ecb9df9e
b919e55 add tests lobsterkatie Jul 27, 2021 https://github.com/getsentry/sentry-javascript/pull/3845/commits/b919e5514fb8c1929bdf9ea9a21c4ca19e99a7bd
Clear filters https://github.com/getsentry/sentry-javascript/pull/3845/files
Please reload this pagehttps://github.com/getsentry/sentry-javascript/pull/3845/files
Please reload this pagehttps://github.com/getsentry/sentry-javascript/pull/3845/files
package.json https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-e5237f683dda3354b835c7c7c94b9759db2c743d4ba94d47d7f8b8e0b2bfb442
types.ts https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-8e3c00802ba457fc07b57c73df10e7719aa757060f8ae47da6329a1d92e08bc4
webpack.ts https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-55396f0a8f12ba2eb7ce27f3cf886f946c29c2aa93b5d2f993dadbd5a9f3cc75
config.test.ts https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-77b0b00c56cf44540996ecbef4caef9f3cf9bf4e9a3176e9d7f028e3b328868d
yarn.lock https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-51e4f558fae534656963876761c95b83b6ef5da5103c4adef6768219ed76c2de
packages/nextjs/package.jsonhttps://github.com/getsentry/sentry-javascript/pull/3845/files#diff-e5237f683dda3354b835c7c7c94b9759db2c743d4ba94d47d7f8b8e0b2bfb442
View file https://github.com/getsentry/sentry-javascript/blob/b919e5514fb8c1929bdf9ea9a21c4ca19e99a7bd/packages/nextjs/package.json
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-javascript/pull/3845/{{ revealButtonHref }}
https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-e5237f683dda3354b835c7c7c94b9759db2c743d4ba94d47d7f8b8e0b2bfb442
https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-e5237f683dda3354b835c7c7c94b9759db2c743d4ba94d47d7f8b8e0b2bfb442
packages/nextjs/src/config/types.tshttps://github.com/getsentry/sentry-javascript/pull/3845/files#diff-8e3c00802ba457fc07b57c73df10e7719aa757060f8ae47da6329a1d92e08bc4
View file https://github.com/getsentry/sentry-javascript/blob/b919e5514fb8c1929bdf9ea9a21c4ca19e99a7bd/packages/nextjs/src/config/types.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-javascript/pull/3845/{{ revealButtonHref }}
https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-8e3c00802ba457fc07b57c73df10e7719aa757060f8ae47da6329a1d92e08bc4
https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-8e3c00802ba457fc07b57c73df10e7719aa757060f8ae47da6329a1d92e08bc4
https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-8e3c00802ba457fc07b57c73df10e7719aa757060f8ae47da6329a1d92e08bc4
https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-8e3c00802ba457fc07b57c73df10e7719aa757060f8ae47da6329a1d92e08bc4
packages/nextjs/src/config/webpack.tshttps://github.com/getsentry/sentry-javascript/pull/3845/files#diff-55396f0a8f12ba2eb7ce27f3cf886f946c29c2aa93b5d2f993dadbd5a9f3cc75
View file https://github.com/getsentry/sentry-javascript/blob/b919e5514fb8c1929bdf9ea9a21c4ca19e99a7bd/packages/nextjs/src/config/webpack.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-javascript/pull/3845/{{ revealButtonHref }}
https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-55396f0a8f12ba2eb7ce27f3cf886f946c29c2aa93b5d2f993dadbd5a9f3cc75
https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-55396f0a8f12ba2eb7ce27f3cf886f946c29c2aa93b5d2f993dadbd5a9f3cc75
https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-55396f0a8f12ba2eb7ce27f3cf886f946c29c2aa93b5d2f993dadbd5a9f3cc75
Please reload this pagehttps://github.com/getsentry/sentry-javascript/pull/3845/files
https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-55396f0a8f12ba2eb7ce27f3cf886f946c29c2aa93b5d2f993dadbd5a9f3cc75
https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-55396f0a8f12ba2eb7ce27f3cf886f946c29c2aa93b5d2f993dadbd5a9f3cc75
https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-55396f0a8f12ba2eb7ce27f3cf886f946c29c2aa93b5d2f993dadbd5a9f3cc75
https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-55396f0a8f12ba2eb7ce27f3cf886f946c29c2aa93b5d2f993dadbd5a9f3cc75
https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-55396f0a8f12ba2eb7ce27f3cf886f946c29c2aa93b5d2f993dadbd5a9f3cc75
Please reload this pagehttps://github.com/getsentry/sentry-javascript/pull/3845/files
packages/nextjs/test/config.test.tshttps://github.com/getsentry/sentry-javascript/pull/3845/files#diff-77b0b00c56cf44540996ecbef4caef9f3cf9bf4e9a3176e9d7f028e3b328868d
View file https://github.com/getsentry/sentry-javascript/blob/b919e5514fb8c1929bdf9ea9a21c4ca19e99a7bd/packages/nextjs/test/config.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-javascript/pull/3845/{{ revealButtonHref }}
https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-77b0b00c56cf44540996ecbef4caef9f3cf9bf4e9a3176e9d7f028e3b328868d
https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-77b0b00c56cf44540996ecbef4caef9f3cf9bf4e9a3176e9d7f028e3b328868d
https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-77b0b00c56cf44540996ecbef4caef9f3cf9bf4e9a3176e9d7f028e3b328868d
https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-77b0b00c56cf44540996ecbef4caef9f3cf9bf4e9a3176e9d7f028e3b328868d
https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-77b0b00c56cf44540996ecbef4caef9f3cf9bf4e9a3176e9d7f028e3b328868d
https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-77b0b00c56cf44540996ecbef4caef9f3cf9bf4e9a3176e9d7f028e3b328868d
https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-77b0b00c56cf44540996ecbef4caef9f3cf9bf4e9a3176e9d7f028e3b328868d
https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-77b0b00c56cf44540996ecbef4caef9f3cf9bf4e9a3176e9d7f028e3b328868d
https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-77b0b00c56cf44540996ecbef4caef9f3cf9bf4e9a3176e9d7f028e3b328868d
https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-77b0b00c56cf44540996ecbef4caef9f3cf9bf4e9a3176e9d7f028e3b328868d
Please reload this pagehttps://github.com/getsentry/sentry-javascript/pull/3845/files
Please reload this pagehttps://github.com/getsentry/sentry-javascript/pull/3845/files
https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-77b0b00c56cf44540996ecbef4caef9f3cf9bf4e9a3176e9d7f028e3b328868d
https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-77b0b00c56cf44540996ecbef4caef9f3cf9bf4e9a3176e9d7f028e3b328868d
yarn.lockhttps://github.com/getsentry/sentry-javascript/pull/3845/files#diff-51e4f558fae534656963876761c95b83b6ef5da5103c4adef6768219ed76c2de
View file https://github.com/getsentry/sentry-javascript/blob/b919e5514fb8c1929bdf9ea9a21c4ca19e99a7bd/yarn.lock
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-javascript/pull/3845/{{ revealButtonHref }}
https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-51e4f558fae534656963876761c95b83b6ef5da5103c4adef6768219ed76c2de
https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-51e4f558fae534656963876761c95b83b6ef5da5103c4adef6768219ed76c2de
https://github.com/getsentry/sentry-javascript/pull/3845/files#diff-51e4f558fae534656963876761c95b83b6ef5da5103c4adef6768219ed76c2de
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlno-cache

Viewport: width=device-width


URLs of crawlers that visited me.