Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error events from nested iFrame do not contain source map debugID reference. #15535

Open
3 tasks done
rodolfoBee opened this issue Feb 28, 2025 · 1 comment
Open
3 tasks done
Labels
Package: browser Issues related to the Sentry Browser SDK

Comments

@rodolfoBee
Copy link
Member

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/browser

SDK Version

9.2.0

Framework Version

No response

Link to Sentry event

No response

Reproduction Example/SDK Setup

There is a sandbox app where the issue happens and more details on how it is configured are available in this internal ticket
See the internal comment from 28/02 with a summary of information.

Steps to Reproduce

  1. Add the Browser SDK to an app with nested iFrames.
  2. Use webpack plugin to upload source maps to Sentry
sentryWebpackPlugin({
authToken: SENTRY_AUTH_TOKEN,
org: <redacted>,
project: 'editor',
telemetry: false,
});
  1. Throw an error in the iFrame

Expected Result

The event sent by the SDK has source maps debugIDs attached to them.

Actual Result

The event does not have the DebugID reference under debug_meta.

Because webpack rename the uploaded files, the fallback of matching abs_path to the uploaded source maps also also fails. Source maps are hosted internally with no access from outside, thus source map fetching also fails.

I can confirm that the minified file has the correct debugID, which is found in the uploaded files to Sentry:
Minified file contains:

p._sentryDebugIds[u]="9ef9d18e-3246-411d-9336-512a031cf002"
...
SENTRY_RELEASE={id:"a5fffa11f6d7735ecd9ddea4d9fd56d64f2b85e1"};

Screenshot from project settings with the uploaded file:

Image
@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Feb 28, 2025
@github-actions github-actions bot added the Package: browser Issues related to the Sentry Browser SDK label Feb 28, 2025
@lforst
Copy link
Member

lforst commented Feb 28, 2025

Seems like the events in question do not have debug IDs attached to them. To me this means that when the error happened, either the debug ID snippets haven't been executed yet (very unlikely / impossible), or the debug IDs do not live in the current global context from where the error was captured. This would make sense if the errors originate from an iframe since the parent window and the iframe don't share a global object (as far as I know). I think this would happen if you did something like this for example: https://stackoverflow.com/a/14041297/21967320 and capturing the exception in the onerror handler.

A way to get around the above would be to also initialize an SDK in the iframe. It could point to a different project, or the same one. Doesn't really matter as long as the right project has the right artifacts uploaded.

You can also use the legacy source map upload that does not depend on debug IDs but artifact paths: https://docs.sentry.io/platforms/javascript/sourcemaps/troubleshooting_js/legacy-uploading-methods/ It would make use of the uploadLegacySourcemaps option: https://www.npmjs.com/package/@sentry/webpack-plugin#releaseuploadlegacysourcemaps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: browser Issues related to the Sentry Browser SDK
Projects
Status: No status
Development

No branches or pull requests

2 participants