-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry self-hosted
Which SDK are you using?
@sentry/angular
SDK Version
"@sentry/angular": "8.35.0" and "@angular-architects/module-federation": "^17.0.8"
Framework Version
"@sentry/angular": "8.35.0"
Link to Sentry event
can't provide, there is private repo
Reproduction Example/SDK Setup
As you mention in documentation, Sentry inits only once in core application.
Sentry.init({
dsn: environment.dsn,
tracesSampleRate: 1.0,
sampleRate: 1.0,
environment: environment.name,
sendDefaultPii: false,
integrations: [
Sentry.browserTracingIntegration({}),
Sentry.captureConsoleIntegration({levels: ['error']}),
Sentry.extraErrorDataIntegration(),
Sentry.httpClientIntegration({
failedRequestStatusCodes: [400, 599],
}),
Sentry.moduleMetadataIntegration()
],
transport,
beforeSend: (event) => {
if (event?.exception?.values?.[0].stacktrace?.frames) {
const frames = event.exception.values[0].stacktrace.frames;
// Find the last frame with module metadata containing a DSN
const routeTo = frames
.filter(
(frame) => frame.module_metadata && frame.module_metadata.dsn,
)
.map((v) => v.module_metadata)
.slice(-1);
if (routeTo.length || window.history.state.dsn) {
event.extra = {
...event.extra,
[EXTRA_KEY]: routeTo.length ? routeTo :
[{
dsn: window.history.state.dsn,
release: event.release
}],
};
}
}
return event;
}
})
In microfrontend with module federation I use this configs:
module.exports = merge(baseConfig, {
devtool: "source-map",
plugins: [
SentryWebpackPlugin({
moduleMetadata: ({ release }) => ({
dsn: "dsn_path",
release,
}),
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
authToken: process.env.SENTRY_AUTH_TOKEN,
})
],
});
Also, sentry dependency doesn't share in core app for other microfrontends.
When http error occurs interceptor in core app call Sentry.captureException(new Error(errorResponse.message))
Steps to Reproduce
- init sentry in core app with mentioned below config
- in microfrontend with module federation add config to webpack config as mentioned below
- reproduce http error with status code 400-599
- such error type get caught by common project because for some reason this condition "frame.module_metadata && frame.module_metadata.dsn" isn't true. However, when another error occurs (for example, method with throw error) it transport error to specific project as expected
Expected Result
transport http errors, which appoint in microfrontend with module federation, from core app by beforeSend to specific project
Actual Result
only http errors which appoint in microfrontend with module federation get caught by common project and can't transport by beforeSend because of false value of this condition "frame.module_metadata && frame.module_metadata.dsn"
Metadata
Metadata
Assignees
Labels
Projects
Status