feat(bundler-plugins)!: Migrate from @sentry/cli to the sentry CLI SDK - #23398
Conversation
size-limit report 📦
|
6091f43 to
6a8fbbe
Compare
6a8fbbe to
ed29e44
Compare
|
This PR is currently blocked by getsentry/cli#1421 |
I opened a PR that is using the new CLI instead of the old `@sentry/cli@2`: getsentry/sentry-javascript#23398 Some E2E tests failed with `TypeError: Bun.serve is not a function`, because we actually check internally if `Bun` would be an option. With that polyfill in this CLI this behavior is now forced, without Bun actually being there. Idk why this actually exists, but exporting `Bun` instead fixes it. --- AI description: The Node polyfills were installed with `globalThis.Bun = BunPolyfill`, which broke consumers of the npm package in both directions. Under Bun the global is readonly, so merely importing the package threw "Attempted to assign to readonly property" and took the whole process down. Under Node it left an object named `Bun` on the global, so unrelated libraries that feature-detect `typeof Bun !== "undefined"` took their Bun code path and called methods the polyfill does not implement, failing with errors like "Bun.serve is not a function". Both are reachable by anyone who merely depends on this package, since importing it is enough. The polyfills are already delivered through esbuild's `inject`, which substitutes unbound identifiers with exported bindings, so exporting `Bun` gives the bundle the same value lexically without touching the global. The real Bun is preferred when present, so running under Bun keeps the genuine implementation rather than shadowing it. Verified by importing the built bundle in Node: `globalThis.Bun` stays undefined, where it previously became an object whose `serve` and `version` were missing. Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
0153d5f to
d67c502
Compare
|
bugbot run |
6ddfabf to
27ea586
Compare
|
bugbot run |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 4 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 27ea586. Configure here.
| ignoreFile: includeEntry.ignoreFile, | ||
| urlPrefix: includeEntry.urlPrefix, | ||
| })), | ||
| ); |
There was a problem hiding this comment.
Legacy include options are ignored
Medium Severity
uploadLegacySourcemaps only forwards paths, ext, ignore, ignoreFile, and urlPrefix. Public IncludeEntry fields urlSuffix, stripPrefix, stripCommonPrefix, sourceMapReference, rewrite, and validate are dropped. The old upload spread the whole include entry, so existing legacy-upload configs now silently change how files are rewritten and named.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 27ea586. Configure here.
There was a problem hiding this comment.
Not sure if we need this with the new CLI though.
| org: this.#options.org, | ||
| project, | ||
| url: this.#options.url, | ||
| }); |
There was a problem hiding this comment.
VCS remote option is unused
Medium Severity
release.vcsRemote is still normalized from the option or SENTRY_VSC_REMOTE, but createSentrySDK never receives it. Auto set-commits will use the CLI default remote instead of the configured one, so non-origin remotes fail or attach the wrong repository.
Reviewed by Cursor Bugbot for commit 27ea586. Configure here.
There was a problem hiding this comment.
It would be prepared here: https://github.com/getsentry/cli/compare/jp/vcs-remote-override?expand=1
We could add this always as a new feature, so it is not blocking for this PR
There was a problem hiding this comment.
not sure either but probably worth double checking if we still need any of these
There was a problem hiding this comment.
Hard to double check tbh there are currently no metrics that proof that. It's also kinda an edge case I assume
nicohrubec
left a comment
There was a problem hiding this comment.
did you actually verify the full ci run takes 4x if we don't use a cli stub? seems like a lot 😅
| org: this.#options.org, | ||
| project, | ||
| url: this.#options.url, | ||
| }); |
There was a problem hiding this comment.
not sure either but probably worth double checking if we still need any of these
0c0b758 to
23a220e
Compare
Replace the @sentry/cli v2 binary wrapper with the programmatic SDK (createSentrySDK) exposed by the new sentry CLI package. A SentryCliAdapter in src/core/cli.ts maps the plugin's structured option shapes onto the SDK's typed methods, keeping all translation in one place: - release create/finalize/set-commits/deploy and sourcemap upload now go through the SDK instead of spawning the CLI binary; one SDK client is created per (options, project) pair since project selection is bound at client creation time - the integration-test fixtures replace the @sentry__cli.patch with a local sentry-stub fixture recording CLI invocations to sentry-cli-mock.json, so upload assertions no longer depend on the binary's internals - remix's release/sourcemap scripts and react-router's buildEnd hook are migrated to the same SDK - add a react-router-7-sourcemaps e2e test app covering the new upload path against a mock Sentry server Requires sentry >= 0.41.0: earlier 0.x builds had a link-fatal named import of Node 22.15+ zstd builtins in the ESM entry, which crashed the whole module on Node 18/20. Co-Authored-By: Claude <noreply@anthropic.com>
The e2e workflow's Playwright setup runs for every test app and fails with exit 127 when the app cannot resolve @playwright/test, even for build-only apps that never launch a browser. react-router-sourcemaps carries the dependency for the same reason. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Nicolas Hrubec <nicolas.hrubec@outlook.com>
…rcemaps The nuxt-4-sourcemaps app merged in #23518 covers the same ground with more variants, so keep that one and port over the assertions it did not have: the release create body, the release finalize call, the chunk-upload options request, and the release reference plus checksum shape on the assemble body. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
23a220e to
8946e63
Compare



closes #18518
closes JS-1312
This PR is removing
@sentry/cliin favor ofsentry.Following was done:
SentryCliAdapterto make the usage a little bit more comfortable (especially around uploading sourcemaps for more projects)On top there is the need for the escape hatchShipped with 0033c76.run()for therelease.deploycommand (this should be fixed with fix(sdk): pass each positional argument as its own argv token cli#1415)sentryCliBinaryExists, because there is no binary anymoreAlso added a new test for nuxt-sourcemaps (as we only had React Router 8 and Next - thought Nuxt is next in line to get a test)They got added after this PR got opened - I added one additional test for nuxt