Sentry on Angular working in localhost (serve) but not on a server (build)
See original GitHub issueI’m trying to work with Sentry for Angular 8.
it’s working great and capturing the error events when served in localhost, but not on a build on the server.
Would love any help to understand why/what’s the difference I’m missing ?
//app.module.ts
Sentry.init({
integrations: [new Sentry.Integrations.Breadcrumbs({
console: false
})],
dsn: "https://somecode@o386725.ingest.sentry.io/sometoken"
});
@Injectable()
export class SentryErrorHandler implements ErrorHandler {
constructor() {}
handleError(error) {
const eventId = Sentry.captureException(error.originalError || error);
Sentry.showReportDialog({ eventId });
}
}
//later added to providers
{ provide: ErrorHandler, useClass: SentryErrorHandler }
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Sentry on Angular working in localhost (serve) but not on a ...
I'm trying to work with Sentry for Angular 8. it's working great and capturing the error events when served in localhost, but not...
Read more >Troubleshooting for Angular
Cross-Origin Resource Sharing (CORS) is a set of APIs (mostly HTTP headers) that dictate how files ought to be downloaded and served across...
Read more >Angular with Sentry — A Step-by-Step Guide
When you create a production build, source maps are not generated for you. This means, you WILL NOT see original files associated with...
Read more >Configuration
This document describes configuration available to the Sentry server itself. First Install During a new install, Sentry prompts first for a walkthrough of ......
Read more >Application Monitoring and Error Tracking - Sentry - YouTube
Will Capozzoli (Solutions Engineer at Sentry ) walks you through how to get the most out of Sentry application monitoring and error tracking ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok, that was my fault.
Sentry.init() was called in separate file, that contained only const provider declaration, although it was imported and used in app.module . It seems that it was a victim of angular tree shaking.
Moving Sentry.init(…) to a file with injectable service (SentryErrorHandler) declaration, as in Sentry angular integration docs, fixed an issue.
Closing this issue for repo cleanup, but if you are still encountering this issue, please let us know.