Skip to content

NextJS Webpack Plugin not including all relevant sourcemaps #16359

Closed

Description

@FabianKoder

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nextjs

SDK Version

9.22.0

Framework Version

Next 15.3.0

Link to Sentry event

No response

Reproduction Example/SDK Setup

No response

Steps to Reproduce

We recently migrated to the Webpack plugin and used to upload the sourcemaps using a GitHub Action - since the migration, we have many issues that throw "In App" but sourcemaps are only available up to a certain point. Previously, the same issues had 100% sourcemap coverage.

Image

As seen here, main-*.js gets explicitly excluded from the sourcemap upload, even with widenClientFileUpload enabled:

// TODO: We should think about uploading these when `widenClientFileUpload` is `true`. They may be useful in some situations.
sourcemapUploadIgnore.push(
path.posix.join(distDirAbsPath, 'static', 'chunks', 'framework-*'),
path.posix.join(distDirAbsPath, 'static', 'chunks', 'framework.*'),
path.posix.join(distDirAbsPath, 'static', 'chunks', 'main-*'),
path.posix.join(distDirAbsPath, 'static', 'chunks', 'polyfills-*'),
path.posix.join(distDirAbsPath, 'static', 'chunks', 'webpack-*'),
);
}

It seems some of our code is being bundled in the main bundle (my suspicion is that in this specific case it happens because the safeParse function is also used in instrumentation-client), which is now not available anymore to view.

Expected Result

Being able to see sourcemaps for the main bundle as well

Actual Result

See reproduction steps

Activity

  1. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on May 22, 2025
  2. chargome commented on May 22, 2025

    @chargome
    Member

    Hey @FabianKoder thanks for reaching out!

    Assuming you already have set widenClientFileUpload: true in your withSentry config, we can try to widen the scope of this flag. We'll look into it!

  3. kylemh commented on May 26, 2025

    @kylemh

    Let me know if there's anything I can provide? I've just setup Sentry with the CLI on a relatively new Next.js App-dir app and had the same results as OP. I had widenClientFileUpload: true (along w/ all the other defaults from the CLI)

    If it helps, this is the feedback I'm seeing Sentry Dashboard

    Image
  4. andreiborza commented on May 27, 2025

    @andreiborza
    Member

    Hi @kylemh, thanks for writing in.

    Just to make sure: Are you deploying the files that have been injected with debug ids, i.e. the files you built are also the files you deployed?

  5. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on May 27, 2025
  6. kylemh commented on May 27, 2025

    @kylemh

    I follow the Docker template for self-hosting and run the next.js build command. I don't feel like I'm doing anything unique in regards to deploying files. Is that a good answer?

  7. 22 remaining items

  8. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on May 27, 2025
  9. cobyeastwood183 commented on May 27, 2025

    @cobyeastwood183

    Hey, had customers writing in about this as well for main-* files. Using sourcemaps: { ignore: [] } in the next.config sentryBuildOptions fixes it and adds the main-* files, without it the events debug ids will not map. Any way we can change those defaults to be just an empty array when widenClientFileUpload option is used?

    https://sentry.zendesk.com/agent/tickets/153478
    https://sentry.zendesk.com/agent/tickets/153680

  10. andreiborza commented on May 28, 2025

    @andreiborza
    Member

    We need to evaluate if everything should be included or if main-* files are enough. @chargome is on it.

  11. FabianKoder commented on May 28, 2025

    @FabianKoder
    Author

    Can confirm issue is resolved by overriding the ignores with the following values:

    [
      '.next/static/chunks/framework-*',
      '.next/static/chunks/framework.*',
      '.next/static/chunks/polyfills-*',
      '.next/static/chunks/webpack-*',
    ]

    Personally, I guess, next internals aren't really needed so these settings could be sufficient.

  12. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on May 28, 2025
  13. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on May 28, 2025
  14. kylemh commented on May 28, 2025

    @kylemh

    Okay. That makes a bit more sense for my situation. I was just testing integration and purposefully throwing errors. The stack traces provided to me were primarily internal (which makes sense in those situations), so the stack trace seemed improper. I'll circle back once I actually see app-related exceptions and their stack traces.

  15. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on May 28, 2025
  16. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on May 28, 2025
  17. github-actions commented on May 28, 2025

    @github-actions
    Contributor

    A PR closing this issue has just been released 🚀

    This issue was referenced by PR #16406, which was included in the 9.23.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions