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

Cannot readable stack trace in angular sentry

Open smrb76 opened this issue 3 years ago • 3 comments

Is there an existing issue for this?

  • [X] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
  • [X] I have reviewed the documentation https://docs.sentry.io/
  • [X] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases

How do you use Sentry?

Self-hosted/on-premise

Which package are you using?

@sentry/angular

SDK Version

7.7.0

Framework Version

7.7.0

Link to Sentry event

No response

Steps to Reproduce

I did the following instruction in angular.json: "sourceMap": { "scripts": true, "hidden": true }

in main.ts:

import {enableProdMode} from '@angular/core';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';

import {AppModule} from './app/app.module';
import {environment} from './environments/environment';
import * as Sentry from '@sentry/angular';
import {BrowserTracing} from '@sentry/tracing';

Sentry.init({
  dsn: environment.sentryDsn,
  environment: 'development',
  release : environment.release,
  integrations: [
    new BrowserTracing({
      tracingOrigins: ['localhost', environment.ApiUrl],
      routingInstrumentation: Sentry.routingInstrumentation
    })
  ],
  tracesSampleRate: 1,
});

if (environment.production) {
  enableProdMode();
}

document.addEventListener('DOMContentLoaded', () => {
  platformBrowserDynamic().bootstrapModule(AppModule)
    .catch(err => console.error(err));
});

in app.module.ts: image

And my Makefile is: image

Expected Result

Expected result is which line of code produce error like this: image

Actual Result

The output from Makefile is complete and finish without any error And release is done and all sourceMaps is uploaded on sentry Dashboard, But Still doesn`t recognize where error is trigger exactly Fat6K

smrb76 avatar Jul 23 '22 07:07 smrb76

Hi @smrb76 and thansk for writing in!

I took a quick look at your SDK config and I just wanted to ask if you followed our Angular setup guide? The reason I'm asking is because it seems to me that your app.module.ts registers the ErrorHandler a little differently than recommended.

However, since you're getting errors but not the correct source maps, I think the problem is more related to the sourcemaps (upload) configuration. Have you tried following our sourcemaps troubleshooting guide? Maybe sentry-cli sourcemaps explain can help out there.

Often for example, the prefix isn't set correctly (I see, you set it to /~ and I'm wondering if this is correct). Maybe try changing this to ~ (which is what I do for my Angular projects). Note that this is always very specific to how you set up your Angular project (structure), which build tools you're using, etc.

Let me know if this helps!

Lms24 avatar Jul 25 '22 12:07 Lms24

Thanks for your response Lukas @Lms24 I think there is problem at sourceMap PATHs after build project(ng build) , my project output is image Because I Use Angular SSR and i need sentry in SSR Environment For this Reason my SDK Config changed a little in app.module.ts: image And app.server.module.ts: image And Error-logger.ts: image

My Question is : How to set urlPrefix ?Should i use stripPrefix? How?

smrb76 avatar Jul 26 '22 08:07 smrb76

Thanks for the information. I agree, the problem is probably related to your sourcemaps filename/path config. Again, I can't exactly tell you what to set here because I don't know how your build directory structure looks. Also, I strongly recommend checking all our sourcemaps materials:

Also, I'd recommend checking the filenames of the uploaded files in Sentry UI (Project Settings -> Sourcemaps)

A final idea: Have you tried researching how other Angular SSR (Universal?) users are uploading sourcemaps? Perhaps there's already someone who figured it out with a similar setup to yours

Lms24 avatar Jul 26 '22 08:07 Lms24

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 label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


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

github-actions[bot] avatar Aug 17 '22 00:08 github-actions[bot]