Skip to content

Commit

Permalink
fix: micro-frontend Add a beforeSend callback that sets an extra prop… (
Browse files Browse the repository at this point in the history
#7873)

* 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 <[email protected]>
  • Loading branch information
18355166248 and shanamatthews authored Sep 25, 2023
1 parent 1db2b53 commit b2c0660
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

1 comment on commit b2c0660

@vercel
Copy link

@vercel vercel bot commented on b2c0660 Sep 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

sentry-docs – ./

sentry-docs-git-master.sentry.dev
sentry-docs.sentry.dev
docs.sentry.io

Please sign in to comment.