sentry-cli icon indicating copy to clipboard operation
sentry-cli copied to clipboard

Source map upload fails when bundled with bun 1.1.4: `got 6 segments, expected 4 or 5`

Open evelant opened this issue 1 year ago • 6 comments

Environment

MacOS sentry-cli 2.31.0

Steps to Reproduce

bun build --target=bun --sourcemap=inline --outdir=dist src/index.ts && sentry-cli sourcemaps inject dist && bun sentry-cli sourcemaps upload dist

Expected Result

Source maps are uploaded

Actual Result

error: got 6 segments, expected 4 or 5

Logs

 bun run clean && bun build --target=bun --sourcemap=inline --outdir=dist src/index.ts && sentry-cli sourcemaps inject dist && bun sentry-cli sourcemaps upload dist
$ rm -rf build && rm -rf .tsbuildinfo

  ./index.js  118401.61 KB

[371ms] bundle 1816 modules
  INFO    2024-04-19 16:53:16.779634 -04:00 Loaded config from /Users/imagio/.sentryclirc
  DEBUG   2024-04-19 16:53:16.779925 -04:00 sentry-cli version: 2.31.0, platform: "darwin", architecture: "arm64"
  INFO    2024-04-19 16:53:16.780179 -04:00 sentry-cli was invoked with the following command line: "/Users/imagio/dev/TaskHero/node_modules/@sentry/cli-darwin/bin/sentry-cli" "sourcemaps" "inject" "dist"
> Searching dist
  DEBUG   2024-04-19 16:53:16.783186 -04:00 built glob set; 0 literals, 0 basenames, 0 extensions, 0 prefixes, 0 suffixes, 4 required extensions, 0 regexes  (from globset)
  DEBUG   2024-04-19 16:53:16.784125 -04:00 whitelisting dist/index.js: Whitelist(IgnoreMatch(Types(Glob(Matched { def: FileTypeDef { name: "js", globs: ["*.js"] } }))))  (from ignore)
  INFO    2024-04-19 16:53:16.784178 -04:00 found: dist/index.js (118401610 bytes)
  DEBUG   2024-04-19 16:53:16.801297 -04:00 whitelisting dist/index.js.map: Whitelist(IgnoreMatch(Types(Glob(Matched { def: FileTypeDef { name: "map", globs: ["*.map"] } }))))  (from ignore)
  INFO    2024-04-19 16:53:16.801350 -04:00 found: dist/index.js.map (83013320 bytes)
> Found 2 files
> Analyzing 2 sources
> Analyzing completed in 0.389s
> Injecting debug ids

Source Map Debug ID Injection Report
  Ignored: The following source files already have debug ids
    f66ab7d3-763c-7f33-6475-6e2164756e21 - dist/index.js

  INFO    2024-04-19 16:53:19.790576 -04:00 Skipping update nagger update check
  INFO    2024-04-19 16:53:19.841144 -04:00 Loaded config from /Users/imagio/.sentryclirc
  DEBUG   2024-04-19 16:53:19.841216 -04:00 sentry-cli version: 2.31.0, platform: "darwin", architecture: "arm64"
  INFO    2024-04-19 16:53:19.841226 -04:00 sentry-cli was invoked with the following command line: "/Users/imagio/dev/TaskHero/node_modules/@sentry/cli-darwin/bin/sentry-cli" "sourcemaps" "upload" "dist"
  DEBUG   2024-04-19 16:53:19.842077 -04:00 request GET https://sentry.io/api/0/organizations/whetware-inc/chunk-upload/
  DEBUG   2024-04-19 16:53:19.842101 -04:00 using token authentication
  DEBUG   2024-04-19 16:53:19.842129 -04:00 retry number 0, max retries: 0
  DEBUG   2024-04-19 16:53:19.892496 -04:00 > GET /api/0/organizations/whetware-inc/chunk-upload/ HTTP/1.1
  DEBUG   2024-04-19 16:53:19.892516 -04:00 > Host: sentry.io
  DEBUG   2024-04-19 16:53:19.892519 -04:00 > Accept: */*
  DEBUG   2024-04-19 16:53:19.892522 -04:00 > Connection: TE
  DEBUG   2024-04-19 16:53:19.892525 -04:00 > TE: gzip
  DEBUG   2024-04-19 16:53:19.892527 -04:00 > User-Agent: sentry-cli/2.31.0
  DEBUG   2024-04-19 16:53:19.893175 -04:00 > Authorization: Bearer sntrys_e***
  DEBUG   2024-04-19 16:53:19.987279 -04:00 < HTTP/1.1 200 OK
  DEBUG   2024-04-19 16:53:19.987312 -04:00 < server: nginx
  DEBUG   2024-04-19 16:53:19.987318 -04:00 < date: Fri, 19 Apr 2024 20:53:19 GMT
  DEBUG   2024-04-19 16:53:19.987323 -04:00 < content-type: application/json
  DEBUG   2024-04-19 16:53:19.987327 -04:00 < vary: Accept-Encoding,Accept-Language, Cookie
  DEBUG   2024-04-19 16:53:19.987332 -04:00 < allow: GET, POST, HEAD, OPTIONS
  DEBUG   2024-04-19 16:53:19.987335 -04:00 < access-control-allow-methods: GET, POST, HEAD, OPTIONS
  DEBUG   2024-04-19 16:53:19.987347 -04:00 < access-control-allow-headers: X-Sentry-Auth, X-Requested-With, Origin, Accept, Content-Type, Authentication, Authorization, Content-Encoding, sentry-trace, baggage, X-CSRFToken
  DEBUG   2024-04-19 16:53:19.987352 -04:00 < access-control-expose-headers: X-Sentry-Error, X-Sentry-Direct-Hit, X-Hits, X-Max-Hits, Endpoint, Retry-After, Link
  DEBUG   2024-04-19 16:53:19.987357 -04:00 < access-control-allow-origin: *
  DEBUG   2024-04-19 16:53:19.987360 -04:00 < x-sentry-rate-limit-remaining: 39
  DEBUG   2024-04-19 16:53:19.987364 -04:00 < x-sentry-rate-limit-limit: 40
  DEBUG   2024-04-19 16:53:19.987367 -04:00 < x-sentry-rate-limit-reset: 1713560000
  DEBUG   2024-04-19 16:53:19.987371 -04:00 < x-sentry-rate-limit-concurrentremaining: 24
  DEBUG   2024-04-19 16:53:19.987374 -04:00 < x-sentry-rate-limit-concurrentlimit: 25
  DEBUG   2024-04-19 16:53:19.987512 -04:00 < content-language: en
  DEBUG   2024-04-19 16:53:19.987537 -04:00 < x-frame-options: deny
  DEBUG   2024-04-19 16:53:19.987545 -04:00 < x-content-type-options: nosniff
  DEBUG   2024-04-19 16:53:19.987551 -04:00 < x-xss-protection: 1; mode=block
  DEBUG   2024-04-19 16:53:19.987570 -04:00 < content-security-policy: script-src 'self' 'unsafe-inline' 'report-sample' s1.sentry-cdn.com js.sentry-cdn.com browser.sentry-cdn.com statuspage-production.s3.amazonaws.com static.zdassets.com aui-cdn.atlassian.com connect-cdn.atl-paas.net js.stripe.com 'strict-dynamic' cdn.pendo.io data.pendo.io pendo-io-static.storage.googleapis.com pendo-static-5634074999128064.storage.googleapis.com; style-src * 'unsafe-inline'; worker-src blob:; media-src *; frame-src app.pendo.io demo.arcade.software js.stripe.com sentry.io; frame-ancestors 'self' *.sentry.io; font-src * data:; img-src * blob: data:; default-src 'none'; base-uri 'none'; object-src 'none'; connect-src 'self' *.algolia.net *.algolianet.com *.algolia.io sentry.io *.sentry.io s1.sentry-cdn.com o1.ingest.sentry.io api2.amplitude.com app.pendo.io data.pendo.io reload.getsentry.net t687h3m0nh65.statuspage.io sentry.zendesk.com ekr.zdassets.com maps.googleapis.com; report-uri https://o1.ingest.sentry.io/api/54785/security/?sentry_key=f724a8a027db45f5b21507e7142ff78e&sentry_release=2f4cdd7170e93e3df091f2c8fe99e953e7b6b499
  DEBUG   2024-04-19 16:53:19.987623 -04:00 < x-envoy-attempt-count: 1
  DEBUG   2024-04-19 16:53:19.987631 -04:00 < x-envoy-upstream-service-time: 50
  DEBUG   2024-04-19 16:53:19.987636 -04:00 < x-served-by: getsentry-web-rpc-production-5f74d499f4-jtrgl
  DEBUG   2024-04-19 16:53:19.987641 -04:00 < x-sentry-proxy-url: http://10.2.0.67:8999/api/0/organizations/whetware-inc/chunk-upload/
  DEBUG   2024-04-19 16:53:19.987646 -04:00 < x-served-by: getsentry-control-web-default-common-production-545f88f6f59k8dt
  DEBUG   2024-04-19 16:53:19.987809 -04:00 < x-served-by: frontend-default-84bf4dbfdc-h7gtw
  DEBUG   2024-04-19 16:53:19.987818 -04:00 < strict-transport-security: max-age=31536000; includeSubDomains; preload
  DEBUG   2024-04-19 16:53:19.987829 -04:00 < via: 1.1 google
  DEBUG   2024-04-19 16:53:19.987834 -04:00 < Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
  DEBUG   2024-04-19 16:53:19.987841 -04:00 < Transfer-Encoding: chunked
  DEBUG   2024-04-19 16:53:19.989691 -04:00 response status: 200
  DEBUG   2024-04-19 16:53:19.989706 -04:00 body: {"url":"https://us.sentry.io/api/0/organizations/whetware-inc/chunk-upload/","chunkSize":8388608,"chunksPerRequest":64,"maxFileSize":2147483648,"maxRequestSize":33554432,"concurrency":8,"hashAlgorithm":"sha1","compression":["gzip"],"accept":["debug_files","release_files","pdbs","sources","bcsymbolmaps","il2cpp","portablepdbs","artifact_bundles","artifact_bundles_v2"]}
  DEBUG   2024-04-19 16:53:19.990724 -04:00 built glob set; 0 literals, 0 basenames, 0 extensions, 0 prefixes, 0 suffixes, 6 required extensions, 0 regexes  (from globset)
  DEBUG   2024-04-19 16:53:19.991210 -04:00 whitelisting dist/index.js: Whitelist(IgnoreMatch(Types(Glob(Matched { def: FileTypeDef { name: "js", globs: ["*.js"] } }))))  (from ignore)
  INFO    2024-04-19 16:53:19.991251 -04:00 found: dist/index.js (118401610 bytes)
  DEBUG   2024-04-19 16:53:20.009641 -04:00 whitelisting dist/index.js.map: Whitelist(IgnoreMatch(Types(Glob(Matched { def: FileTypeDef { name: "map", globs: ["*.map"] } }))))  (from ignore)
  INFO    2024-04-19 16:53:20.009707 -04:00 found: dist/index.js.map (83013320 bytes)
> Found 2 files
> Analyzing 2 sources
> Analyzing completed in 0.382s
> Rewriting sources
error: got 6 segments, expected 4 or 5
  INFO    2024-04-19 16:53:20.688041 -04:00 Skipping update nagger update check
error: "sentry-cli" exited with code 1
error: script "build" exited with code 1

evelant avatar Apr 19 '24 20:04 evelant

Also tried building with --sourcemap=external. Same result.

evelant avatar Apr 19 '24 20:04 evelant

Ah, it seems I needed --no-rewrite. The error message isn't super helpful.

evelant avatar Apr 19 '24 21:04 evelant

Ah, it seems I needed --no-rewrite. The error message isn't super helpful.

@evelant Is this issue resolved?

szokeasaurusrex avatar Apr 22 '24 08:04 szokeasaurusrex

My problem is resolved, but IMO it would be good to improve the error message to avoid future confusion

evelant avatar Apr 22 '24 11:04 evelant

My problem is resolved, but IMO it would be good to improve the error message to avoid future confusion

@evelant I completely agree. We can keep this issue open on our backlog to improve the message.

Would you perhaps be able to share a link to your source code repo, if it is public, to help me reproduce the error you observed?

szokeasaurusrex avatar Apr 23 '24 09:04 szokeasaurusrex

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

getsantry[bot] avatar May 15 '24 07:05 getsantry[bot]