question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Re-examine usage of sentry-cli and bundler plugins

See original GitHub issue

Problem Statement

https://github.com/getsentry/sentry-javascript/issues/4894#issuecomment-1193216873 brings up sentry-cli size issues.

Essentially, due to sentry-cli’s binary size, we require users to have some kind of bundling setup to make sure that they tree shake away sentry-cli in application code.

Is there a way we can improve this situation?

There’s also the concern here with bundlers. Right now we only have a single 1st party plugin, for webpack: https://github.com/getsentry/sentry-webpack-plugin

There is also a community vite plugin:

The more bundlers we support, the better the out of the box experience is (less finagling with sentry-cli).

Solution Brainstorm

Sentry-cli usage

My musings from slack for the sentry-cli size problem:

  1. Produce a minimized version of sentry-cli that pretty much only exposes the API around sourcemaps/releases
  2. Expand the amount of bundler plugins we have, (go from just webpack -> rollup, webpack, vite, esbuild, we know how to do this)
  3. Make sure the framework SDKs include a bundler plugin, and those bundler plugins only use the minimal sentry-cli. Another option here is that we can try making adding build time plugins/steps a Step 2 in the onboarding wizard (after yarn add and Sentry.init). Mobile has something similar where you need to explicitly add the gradle plugin for Android for ex.

Note: We’ll need to DACI how exactly we make sentry-cli smaller, basically choose between re-writing the needed functionality in JS vs. stripping the CLI rust binary at compile time.

Bundlers

There is https://github.com/unjs/unplugin, which allows us to have a single codebase for bundlers (perhaps in the SDK monorepo 👀). It also uses the rollup plugin API, which @lobsterkatie does have a lot of experience with.

@asonnleitner did some awesome work with https://github.com/asonnleitner/unplugin-sentry as per https://github.com/getsentry/sentry-javascript/discussions/4989. We can def use that as a starting point!

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:5
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
AbhiPrasadcommented, Jul 25, 2022

If we proceed with https://github.com/unjs/unplugin, we’ll go in knowing we have to contribute back upstream - maybe we can fix those inconsistencies?

0reactions
lobsterkatiecommented, Jul 25, 2022
  • I think trying to reduce the size of the existing Sentry CLI is the wrong angle of attack: Unnecessary complexity + will grow again when new features are added. As a quick fix, maybe, but it’s not a sustainable solution.

If this were done as a proverbial Pick<sentry-cli, 'releases' | 'sourcemaps'> rather than an Omit<sentry-cli, 'all' | 'of' | 'the' | 'other' | 'many' | 'commands'>, I don’t see why it would grow significantly over time.

I’m not philosophically against your translate-everything-to-js idea, but it does seem like it’d be more work (and more maintenance) than just wrapping a stripped-down cli tool.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Remix Framework SDK - getsentry/sentry-javascript - GitHub
Uses React + Node SDK under the hood. Hook into build pipeline and ... Re-examine usage of sentry-cli and bundler plugins #5461. Open....
Read more >
How to write a Bundler plugin
This guide will help you start writing your own Bundler plugins. Why would I use a plugin? Plugins are able to integrate with...
Read more >
Command Line Interface - Sentry Documentation
Learn how to use the `sentry-cli` command line executable. ... It's primarily used for managing debug information files for iOS, Android as well...
Read more >
Re-examine usage of sentry-cli and bundler plugins
For the use of sentry-cli in the plugin a lot of stuff can be easily removed at compile time. Even without removing debug...
Read more >
@sentry/webpack-plugin | Yarn - Package Manager
Official webpack plugin for Sentry. sentry, sentry-cli ... build: Bump @sentry/cli version to 1.74.6 (#406) ... Use it. $ yarn add @sentry/webpack-plugin ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found