Skip to content

sourcemaps.deleteSourcemapsAfterUpload breaks Vercel deployment #13099

Description

@ocavue

Environment

SaaS (https://sentry.io/)

Steps to Reproduce

I'm using Vercel to deploy my Next.js project. When I enable sourcemaps: { deleteSourcemapsAfterUpload: true } in next.config.js, I get the following error from Vercel:

Error: ENOENT: no such file or directory, lstat '/vercel/path0/.next/server/chunks/195.js.map'

More detailed output:


Route (pages)                              Size     First Load JS
┌ ○ /                                      8.71 kB         163 kB
├   └ css/88d021db95f13dbf.css             2.02 kB
├   /_app                                  0 B             154 kB
├ ○ /404                                   438 B           155 kB
├ ƒ /api/sentry-example-api                0 B             154 kB
├ ƒ /api/test1                             0 B             154 kB
├ ƒ /api/test2                             0 B             154 kB
├ ƒ /api/test3                             0 B             154 kB
├ ƒ /api/test4                             0 B             154 kB
├ ○ /client/test1                          429 B           155 kB
├ ○ /client/test2                          456 B           155 kB
├ ○ /client/test3                          445 B           155 kB
├ ○ /client/test4                          467 B           155 kB
├ ○ /sentry-example-page                   1.86 kB         156 kB
├ ƒ /ssr/test1                             431 B           155 kB
├ ƒ /ssr/test2                             429 B           155 kB
├ ƒ /ssr/test3                             430 B           155 kB
└ ƒ /ssr/test4                             432 B           155 kB
+ First Load JS shared by all              155 kB
  ├ chunks/framework-8722668362422965.js   45.3 kB
  ├ chunks/main-4d4ce5325c2179ff.js        32.2 kB
  ├ chunks/pages/_app-c18a80145f513654.js  76 kB
  └ other shared chunks (total)            1.66 kB
○  (Static)   prerendered as static content
ƒ  (Dynamic)  server-rendered on demand

Error: ENOENT: no such file or directory, lstat '/vercel/path0/.next/server/chunks/195.js.map'

I've created a minimal repo to reproduce this issue: https://github.com/ocavue/nextjs-sentry-vercel-deploy-issue

You can see from the GitHub webpage that the Vercel deployment failed after I enable deleteSourcemapsAfterUpload.

Image

Expected Result

No error.

Actual Result

Vercel deployment fails, as shown above.

Product Area

Unknown

Link

No response

DSN

No response

Version

8.20.0

Activity

  1. getsantry commented on Jul 30, 2024

    @getsantry

    Assigning to @getsentry/support for routing ⏲️

  2. ocavue commented on Jul 30, 2024

    @ocavue
    Author

    It seems that when deleteSourcemapsAfterUpload is enable, all .js.map files under .next/ are deleted. (source code)

    And based on the error message above, it seems that Vercel does need .next/server/chunks/195.js.map. Maybe we should only clean .map files under .next/static/.

  3. moved this from Waiting for: Support to Waiting for: Product Owner in GitHub Issues with 👀 3on Jul 30, 2024
  4. Lms24 commented on Jul 30, 2024

    @Lms24
    Member

    Hey @ocavue thanks for writing in and thanks for providing a reproduction! I'll take a look and report back.

  5. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Jul 30, 2024
  6. Lms24 commented on Jul 30, 2024

    @Lms24
    Member

    I can reproduce the issue on Vercel (but not locally, so just like you described). Talked a bit about this with @lforst - it's probably fine for us to only delete client-side source maps and not every source map. We'll fix this soon.

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions