-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
sentry-trace and baggage headers are not attached to XHR Requests #8527
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
Hey @JustDoItSascha, you only need to define Re: this problem, did it work before? Or has this never worked?
How are you making the requests with |
Like always: I inject HttpClient in the constructor and then
this.httpClient.get('url') for example.
I already tried other targets, but with /^http/ it should also match all
requests.
And it's working when I do a fetch(), but not HttpClient.get().
It never worked in this Project. Installed sentry freshly in this Project.
|
@Lms24 have you ran into this before? |
I also disabled all Interceptors to be sure that there are no side effects. I'm not sure how Sentry adds the header to all XHR requests. If it's even possible that there are side effects... |
This comment was marked as off-topic.
This comment was marked as off-topic.
Our Is there a way you can provide us a reproduction to debug further @JustDoItSascha? |
Unfortunately that does not explain HOW it will be attached technically or where I could start debugging to find the issue... And no, i can't provide a reproduction, because I would have to copy the whole repository. :( |
Here's the part of the code that determines how headers are attached:
Is there a way to provide a minimal repro with a plain angular 12 app? |
I will see if I can provide it. In the meantime I found out that this log will not appear in the faulty project:
But it appears in other projects with Angular 16 for example. Edit: |
@onurtemizkan - could you help investigate and reproduce this? |
Ok, sorry guys, I found the issue and I hope that it will maybe help some other folks out there if the stumble across this: The error was not Sentry, but another library called pace-js. This library overwrites the XMLHttpRequest object in that way:
Therefore Sentry cannot overwrite methods like open and send on the XMLHttpRequest prototype, because the prototype is now the function and not the initial XMLHttpRequest class. Ater removing pace-js (a library not updated for 2 years) it works well :) Thanks for your help. Without I wouldn't have find it because I wouldn't have known where to look in the Sentry code to debug it :) |
Wow, that must have been hard to pin down.
Yeah this seems plausible. We'd normally suggest raising an issue in the library repo but given that it's not been updated in 2 years I'm not sure this will help much. Hope you can find a replacement for it :) Thanks for letting us know! Closing the issue for the time being. |
Is there an existing issue for this?
How do you use Sentry?
Self-hosted/on-premise
Which SDK are you using?
@sentry/angular
SDK Version
7.58.1
Framework Version
Angular 12.2.17
Link to Sentry event
No response
SDK Setup
Steps to Reproduce
I have an Angular 12 application where I added sentry. But the sentry-trace header is not attached to XHR Requests initiated by HttpClient. When I'm doing a
fetch()
manually, then the header is set.Expected Result
I see the sentry-trace header in the request.
Actual Result
I don't the the header in the request.
The text was updated successfully, but these errors were encountered: