-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Error events from nested iFrame do not contain source map debugID reference. #15535
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
Comments
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 |
Thanks!
Does this have the potential of creating duplicate events in Sentry, where some are with source maps and others are without? |
It depends on your setup. If you are sending over the errors to the parent window, then yes, the errors will be captured twice. You could somehow in a generic location set a property on the errors before they're being propagated upwards to the parent, and in the SDK in the parent window use |
@lforst Given that Sentry is initialized both on the top window and the child iFrame, do you think that if we prevent the error from propagating up it would be sufficient to prevent duplications? And if we prevent it, will Sentry still capture it? window.addEventListener("error", function (event) {
Sentry.captureException(event.error || event.message);
event.stopPropagation();
}, true); |
Hi @lforst, |
Hey @mbarzeev just tried this but could spot the error in your issue stream, could you specify the error name? Also looked for my specific url in tags but couldn't find it. |
Hi @chargome,
Thanks. |
Hey @mbarzeev thanks for clarifying, I was now able to produce an error and inspect it in your issue feed. Could confirm that the SDK is initialised on your iframe. It looks like the issue is actually sourcemapped with debugId references? |
You are right, it does appear to have the source map (with the misalignment in lines, but that's another story). I wonder why we didn't get that earlier... either we missed something, or the nature of the error was different 🤔 |
If you are using debug IDs the SDK must be initialized in the iframe. If you're ready to go through the pain of matching sourcemaps to stackframes via file-path you can also use the legacy uploading method.
I doubt there is a bug. To me it seems like the SDK was previously not initialized in the iframe. Note that when you are passing errors from iframe to parent, sourcemapping will not work - so if you are still doing that, you may get unmapped events. |
Why was this issue closed? This issue hasn't been touched recently and no longer seems relevant. Please feel free to leave a comment if you think this issue should be reopened. |
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
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:
Screenshot from project settings with the uploaded file:
The text was updated successfully, but these errors were encountered: