Skip to content

feat(nextjs): Add widenClientFileUpload option #4827

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

Merged
merged 3 commits into from
Mar 22, 2022

Conversation

lobsterkatie
Copy link
Member

@lobsterkatie lobsterkatie commented Mar 11, 2022

This documents the option added in getsentry/sentry-javascript#4705, which allows users to choose to cast a wider net when uploading sourcemaps for client-side code.

@vercel
Copy link

vercel bot commented Mar 11, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/sentry/sentry-docs/688hU7utRAyCFxjxEQedeWSnviJa
✅ Preview: https://sentry-docs-git-kmclb-add-widenclientfileupload-nextjs-option.sentry.dev

Copy link
Contributor

@lforst lforst left a comment

Choose a reason for hiding this comment

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

Hi Katie, the new section reads excellent and also explains our intention behind the added option really well.

I also peeked over at getsentry/sentry-javascript#4705 and the changes there also LGTM. (love the tests)

I have one tiny nit but consider this PR approved: widenClientFileUpload doesn't explain too well what it does. The main question I would have while seeing this option for the first time would be: To what scale am I widening the file upload? What files are now included?

However, nobody is gonna use this option unless they have read the documentation behind it, so I don't think it really matters.

@lobsterkatie
Copy link
Member Author

Yup, I can see what you mean, but I don't see a way to make it more specific without the option name being a dozen words long, LOL. I think that in this case, as you say, context clues will carry the day.

Copy link
Contributor

@imatwawana imatwawana left a comment

Choose a reason for hiding this comment

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

Some small wording stuff, but otherwise fine. If you don't like the suggestion I made for replacing "tell...apart", let me know and we can figure out something better.

lobsterkatie added a commit to getsentry/sentry-javascript that referenced this pull request Mar 14, 2022
When nextjs builds an app, compiled versions of each page end up in `.next/static/chunks/pages`. In some circumstances, however, user-generated code ends up outside of `pages/`, and in those cases sourcemaps are broken because the relevant files aren't being uploaded.

This fixes that by optionally widening the scope of the upload, while excluding files known to contain only nextjs and webpack code. (Every build will generate other files which should be excluded, but there's no way to tell in advance what they're going to be called.) In order to reduce the number of irrelevant files being uploaded to Sentry, this behavior is off by default, but can be turned on with a new option `widenClientFileUpload`:

```
const { withSentryConfig } = require("@sentry/nextjs");

const moduleExports = {
  sentry: {
    widenClientFileUpload: true,
  },
};

const sentryWebpackPluginOptions = {
  // ...
};

module.exports = withSentryConfig(moduleExports, sentryWebpackPluginOptions);
```

This change is documented in getsentry/sentry-docs#4827.

Fixes #3896
@lobsterkatie lobsterkatie force-pushed the kmclb-add-widenClientFileUpload-nextjs-option branch from 4e8c3f4 to 956e8a4 Compare March 22, 2022 19:10
@lobsterkatie lobsterkatie marked this pull request as ready for review March 22, 2022 19:15
@lobsterkatie lobsterkatie enabled auto-merge (squash) March 22, 2022 19:15
@lobsterkatie lobsterkatie merged commit a06ad22 into master Mar 22, 2022
@lobsterkatie lobsterkatie deleted the kmclb-add-widenClientFileUpload-nextjs-option branch March 22, 2022 19:17
@github-actions github-actions bot locked and limited conversation to collaborators Apr 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants