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

Uploading source maps steps 1, unclear when using nx+angular and alternate builders.

Open giantslogik opened this issue 1 year ago • 7 comments

Core or SDK?

Platform/SDK

Which part? Which one?

NX+Angular

Description

Was trying to setup sourcemap upload for an nx+angular project. (Have already integrated Sentry using the angular-ivy SDK).

The documentation here , assumes i'm using the default executor @angular-devkit/build-angular:browser .

I'm currently using the newer build system executor (>= Angular 17) @angular-devkit/build-angular:application and also intend to evaluate the esbuild executor @angular-devkit/build-angular:browser-esbuild.

Its unclear on how to setup sourcemap upload when using a different executor.

Suggested Solution

Its unclear if this is a documentation issue or a sdk support issue. (maybe both)

  1. Does the Sentry webpack plugin work when using @angular-devkit/build-angular:application? Are the setup instructions the same ? What about step 1 ?
  2. Need Instructions when using the executor @angular-devkit/build-angular:browser-esbuild
  3. I'm using nx, so potentially need instructions for any of the angular executors

giantslogik avatar Feb 09 '24 10:02 giantslogik

Assigning to @getsentry/support for routing ⏲️

getsantry[bot] avatar Feb 09 '24 10:02 getsantry[bot]

Routing to @getsentry/product-owners-sdks-web-frontend for triage ⏲️

getsantry[bot] avatar Mar 01 '24 21:03 getsantry[bot]

Hey @giantslogik thanks for writing in and apologies for the late reply!

You're bringing up a good point! This guide was written after users asked how they could use our webpack plugin with an Nx+Angular project (https://github.com/getsentry/sentry-javascript/issues/8267). At the time of writing, I didn't consider that you're already using other Nx/Angular builders or even other bundlers.

To keep my reply short: Uploading source maps should always work if you're able to register bundler plugins. In the case of Angular (and Nx) the most logical choice was Webpack but esbuild should work just as well. I recommend following our general guides for webpack or esbuild. Ultimately, you just need a configuration in which you can register plugins to your bundler.

The reason why the specific Angular CLI and Nx Angular CLI guides exist is because default setups don't allow you to add plugins. Even in this case, there's a third option which always works: Uploading source maps via the Sentry CLI.

Lms24 avatar Mar 05 '24 12:03 Lms24

I'll reword step one in the Nx guide to better reflect the intention. Step 2 is basically equivalent to the general guide.

Lms24 avatar Mar 05 '24 12:03 Lms24

I opened https://github.com/getsentry/sentry-docs/pull/9335 to improve the guide a bit. Please feel free to take a look at the PR for preliminary instructions. If you wanna leave a review, that's much appreciated :)

Lms24 avatar Mar 05 '24 13:03 Lms24

@Lms24 Thanks, the improved guide did clarify things. To have the maximum flexibility to switch builders, i've gone with the sentry-cli. Are there any advantages to the bundler plugins v/s sentry-cli?

giantslogik avatar Mar 08 '24 04:03 giantslogik

@giantslogik the bundler plugins offer a bit more out of the box functionality to manage releases, set commits, deployment information, etc. You can do all of this in the CLI, it's just more commands that you have to manually execute (or put in a script/add to your CI/etc). But to be fair, I also think the CLI is still the most flexible and least cumbersome way for sourcemaps upload in Angular apps. It's an unfortunate consequence of Angular's closed build system :(

Lms24 avatar Mar 08 '24 16:03 Lms24