Skip to content
New issue

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

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

Already on GitHub? # to your account

Next.js: Sourcemaps are being generated for edge despite no sentry.edge.config.ts #15849

Closed
3 tasks done
vernak2539 opened this issue Mar 27, 2025 · 3 comments
Closed
3 tasks done
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK

Comments

@vernak2539
Copy link

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.5.0

Framework Version

Next.js 15.2.3, React 18.3.1

Link to Sentry event

No response

Reproduction Example/SDK Setup

No response

Steps to Reproduce

  1. Install sentry per docs https://docs.sentry.io/platforms/javascript/guides/nextjs/
  2. Remove sentry.edge.config.ts
  3. Remove inclusion of edge config in instrumentation hook
  4. Build

Expected Result

I'd expect that when running next build (using withSentryConfig) that sourcemaps are not created and uploaded for the edge environment. Maybe there's another way to disable the edge environment.

Actual Result

Edge sourcemaps are created and uploaded to sentry

    ~/f236c457-1649-4a13-a47d-db04665af002-54.js.map (debug id f236c457-1649-4a13-a47d-db04665af002)
    ~/f362255e-7995-4ef1-83b3-be17d1b5d82b-141.js.map (debug id f362255e-7995-4ef1-83b3-be17d1b5d82b)
    ~/f4b1832c-325d-4394-8136-de9ac8c7e0a6-157.js.map (debug id f4b1832c-325d-4394-8136-de9ac8c7e0a6)
    ~/f5350f9f-d95c-494a-a627-099755734877-75.js.map (debug id f5350f9f-d95c-494a-a627-099755734877)
    ~/f5edacc5-2870-4ef1-9ffe-8b5f553c8345-167.js.map (debug id f5edacc5-2870-4ef1-9ffe-8b5f553c8345)
    ~/f7d1b362-4009-414b-8e09-50256ba4de49-104.js.map (debug id f7d1b362-4009-414b-8e09-50256ba4de49)
    ~/f809e5df-99ad-4650-9b55-3f5dc3c804a3-34.js.map (debug id f809e5df-99ad-4650-9b55-3f5dc3c804a3)
    ~/f8c35539-8925-42be-862d-7519ab3a4774-173.js.map (debug id f8c35539-8925-42be-862d-7519ab3a4774)
    ~/fbd06441-3f30-4928-bd0f-3254d3cbd57f-132.js.map (debug id fbd06441-3f30-4928-bd0f-3254d3cbd57f)
[@sentry/nextjs - Edge] Info: Successfully uploaded source maps to Sentry
  WARN    2025-03-27 10:53:18.713092868 +00:00 The --use-artifact-bundle option and the SENTRY_FORCE_ARTIFACT_BUNDLES environment variable are both deprecated, and both will be removed in the next major version.
> Found 491 files
> Analyzing 491 sources
> Analyzing completed in 0.07s
> Adding source map references
> Bundling completed in 1.436s
> Bundled 491 files for upload
> Bundle ID: 600a29ee-2808-51d9-b155-2552c9e62ae9
> Optimizing completed in 0.038s
> Uploading completed in 0.966s
> Uploaded files to Sentry
> Processing completed in 0.199s
> File upload complete (processing pending on server)
> Organization: *********
> Project: ******************
> Release: production-2209f616cd37095828a751d1b398cb0b995ddd03
> Dist: None
> Upload type: artifact bundle
@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Mar 27, 2025
@github-actions github-actions bot added the Package: nextjs Issues related to the Sentry Nextjs SDK label Mar 27, 2025
@lforst
Copy link
Member

lforst commented Mar 27, 2025

Thanks for writing in. We'll take a look.

@lforst
Copy link
Member

lforst commented Mar 27, 2025

Actually, now that I think of this, this is currently unfixable because we cannot detect at build-time whether the edge runtime is in use and the Sentry SDK is initialized for the edge runtime or not. We are uploading when Next.js does the edge runtime build pass. I'll need to go ahead and close this - thanks for reporting though!

To lessen the blow a bit: Next.js is working on a hook that runs at the end of the build and we'll be able to use that to upload sourcemap. This will lead to only one uploading pass to happen. 👍

@lforst lforst closed this as not planned Won't fix, can't repro, duplicate, stale Mar 27, 2025
@vernak2539
Copy link
Author

@lforst thanks for the quick response!

Makes sense, as Next is the one doing the building and sourcemap generation (slipped my mind, sorry!). So there's no way to stop next from building this env? (maybe a question for elsewhere)

To lessen the blow a bit: Next.js is working on a hook that runs at the end of the build and we'll be able to use that to upload sourcemap. This will lead to only one uploading pass to happen. 👍

This may be one to add into #15100 (comment) (I don't see it mentioned there)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK
Projects
Archived in project
Development

No branches or pull requests

2 participants