From b2c0660373db8114c4101915cfb7992e91cb14da Mon Sep 17 00:00:00 2001 From: Swell Date: Tue, 26 Sep 2023 07:45:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20micro-frontend=20Add=20a=20beforeSend=20?= =?UTF-8?q?callback=20that=20sets=20an=20extra=20prop=E2=80=A6=20(#7873)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: micro-frontend Add a beforeSend callback that sets an extra property with the target DSN/release FindLast cannot be used here because it does not return an array, and the current writing method cannot obtain dsn and release. Only by using the modified writing method, can the correct event. xtra be uploaded to the sub application's Sentry through Transport * run linter --------- Co-authored-by: Shana Matthews --- .../common/configuration/micro-frontend-support.mdx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/platforms/javascript/common/configuration/micro-frontend-support.mdx b/src/platforms/javascript/common/configuration/micro-frontend-support.mdx index 999816be7d4fe..e39e2da26f735 100644 --- a/src/platforms/javascript/common/configuration/micro-frontend-support.mdx +++ b/src/platforms/javascript/common/configuration/micro-frontend-support.mdx @@ -218,10 +218,9 @@ init({ 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.findLast( - (frame) => frame.module_metadata && frame.module_metadata.dsn - ) || []; + const routeTo = frames + .filter((frame) => frame.module_metadata && frame.module_metadata.dsn) + .map((v) => v.module_metadata); if (routeTo.length) { event.extra = {