-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Bug: no xhr breadcrumbs for error in onreadystatechange #1333
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
@ilfa sorry for such a long response time, we were swamped. I'm not sure if I understand the issue tbh. Do you by any chance still have this fiddle link? 😅 |
Closed due to inactivity. Please feel free to reopen this issue if this also happens in v4 sdk. Cheers! :) |
Hello, I think I've encountered the same problem (we can discuss if this is a problem or a bug) in current version of Sentry. I'm not sure if I should open new issue for it, or if we can reopen this one. Please guide me. /cc @kamilogorek The problem:
This reports the request/response error to Sentry. So far so good. However, out-of-the-box, one important data is missing in such scenario: the report will not contain the xhr breadcrumb for the It is because both webapp handler ( To better illustrate the issue, I think the following variant would capture the breadcrumb in the report perfectly:
Is this expected behavior intended by Sentry design? Or is there a flaw in Sentry xhr breadcrumb instrumentation affecting this particular scenario? As a reference, the relevant code from axios: https://github.com/axios/axios/blob/master/lib/adapters/xhr.js#L28
|
@stefan-hc hey, I just tried to reproduce this exact use-case with no luck. Are you able to do that for me, please? Here is my test case example and the results (which includes both, error and breadcrumb itself): |
@stefan-hc and more "real-world" endpoint: |
Sure, will do. Give me a moment :) |
One thing that I've noticed: you're trying to reproduce this with Node.js environment, am I correct? I've encountered this problem when using Sentry in browser. So I speculate this might be browser-specific thing? Maybe node.js has different implementation of "onreadystatechange" handlers... In anyway, I'll try to prepare you later this day a fiddle illustrating my issue. Ok? |
Ah, you are correct. I somehow linked Axios with node environment in my head by default. Reproduced it locally. Will try to debug this week. |
Jolly good. Just for the record: it's not very urgent/important to me, as I went with Thanks for addressing my report. |
Ah, and by doing some archaeology in the repo here, I've found that in older versions it might have been working as expected: It seems to me that in version 5.10.2 Sentry was detecting if there is already |
@stefan-hc the issue was that we were attaching the handler inside |
Make sense. There is a possibility that in future Axios (or other 3rd party) might attach its handler before even 👍 |
@stefan-hc correct, but there's not much we can do about it without messing with capture logic itself ¯_(ツ)_/¯ |
Aye. I'm clearly not seeing the full picture, but it seems to me the way to go would be to reuse the same technique as in this change: 973cfde#diff-e98689aa6fecf76cef53f19d1873643bL254-L260
Do you happen to remember why did you had to remove that 'wrap to existing handler' functionality from Sentry? ref commit: 973cfde ? If yes - just ignore me. I really don't need the answer, I'm just double checking you don't miss some opportunity here. #2643 suits my needs perfectly. |
@stefan-hc I did some testing, and the current solution handles both cases However, as you pointed out, it won't work if they are called before So, the only way it could not work now is if someone does something like:
But in this case, they'd also get the listener called for the initial Thanks for pointing that out! We should release new version Today. |
Oh wow, that's really deep - I mean, these Thanks for update, I think I'll switch to newer Sentry version asap... |
@stefan-hc |
Fixed. The order in the universe is restored once again. ☕ |
Uh oh!
There was an error while loading. Please reload this page.
I think it's a bug
When Raven instruments
XMLHttpRequest
and error occurs inonreadystatechange
user function we don't see current request details in breadcrumbs for current error, because Raven log request inonreadystatechange
after user code.What is the current behavior?
Here is fiddle, just check console and see order of
ravenTransport breadcrumb
andsetBreadcrumbCallback
messages.What is the expected behavior?
It will be great if Raven can put xhr request info in breadcrumbs for
onreadystatechange
too.The text was updated successfully, but these errors were encountered: