-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Apollo Client throwing a TypeError: options.headers.hasOwnProperty is not a function
#11555
Comments
Hey @raopg 👋 That is very odd. For one, that line number makes no sense given the code. Here is the code for 3.8.8 in apollo-client/src/link/http/createHttpLink.ts Line 127 in 89ec18e You'll see that its just an empty line. The closest thing I could maybe see is this one: apollo-client/src/errors/index.ts Line 45 in e1794c4
I do see this file in that stack trace, but again, this line number doesn't line up with that stack trace above. That and this change has been here for what looks like 7 years, so I would have assumed we'd see something by now if this was the reason. All of our other usages of Is there any more information you're able to give us? Is this specific to 3.8.8 and does downgrading/upgrading to a specific version help in any way? |
Hi @jerelmiller,
Here is a screenshot, so you can see the line numbers. It is a very odd case, since our engineering team is unable to reproduce it in a dev or prod environment. 2 of our customers are seeing this only on Safari (with all browser extensions disabled). |
We have been seeing this since Apollo 3.7.3, and upgrading/downgrading versions of Apollo has not helped |
Awesome. Appreciate that context! Let me go and see what might have changed in that version to try and get a clue. Gotta love those cross browser quirks sometimes (if thats what it is 😆) |
Interestingly I don't see anything changed having to do with Unfortunately I've got a few other priorities I've got to look at today, so I'll need to revisit later. If you have a revelation or spot it before I do, let me know and we'd be happy to address! PRs welcome as well 🙂 |
Adding a note here, this might be possibly related: #10403 |
@raopg see this comment in #10403 to see if this applies in your situation at all. |
This is our link setup |
From what I gather in that comment, it doesnt seem like its the same issue. I will also investigate to see if there is anything I can spot |
Bummer, worth a shot. Do let me know if you come up with anything! The only other thing I can think of is perhaps to check the bundled output of the client and see if you spot anything in there with This is the only thing I can think of at this point 😕 |
We are getting this from the preflight call, but I was unable to reproduce it in a code sandbox. |
Hey @radu-nicoara-bayer 👋 Thanks for providing that reproduction! Unfortunately I'm still not able to reproduce the issue, even in Safari. Our best lead right now is that this might come from some kind of Safari extension. What Safari version are you using and what extensions do you have installed? I'd like to install them myself to understand if one of them might be at play here. We had an internal report of something very similar as well. We noticed the stack trace of the error included something like the following:
(which also corresponds with the initial report here) From what we can find, this looks like something Safari does with extensions: https://bugs.webkit.org/show_bug.cgi?id=246010. Part of the stack trace also seems to point at the apollo-client/src/link/http/createHttpLink.ts Line 188 in 1a9c68a
My guess is that an extension is trying to replace |
My safari version is Version 17.5 (19618.2.12.11.6), and it is running on a Mac M1 (Maybe that matters as well). As for extensions, I have nothing installed. |
That matches with the setup I have here - unfortunately I don't see the error in the CodeSandbox :/
Are you sure there's not maybe some plugin or extension installed by something like 1Password? |
What annoyingly hidden bug - I'm glad you could find that! I guess at this point, we can close the issue here and you make a bug report with the vendor of that extension? (If it ends up in a public bug tracker, I'd would be very thankful if you could link that here!) |
It seems all iOS has the issue :( social.dotku.us |
@dotku Could you please provide your iOS version, browser version and a list of all installed browser extensions or other installed "privacy"-type apps? |
I ran into this issue myself where the Forcepoint Safari Extension / Websense Endpoint Helper extension was forced on to my computer by corporate leaving me with no options but to dive in and see what is going on. Inside of the SafariExtension, they hijack the The right fix is for the plugin to do a, What I ended up doing to get things to work, and mind you I'm not using this apollo client directly, I'm using Apollo Client exposes apollo-client/src/link/http/createHttpLink.ts Line 185 in 36d2cae
For whatever reason, the object assign of the headers object got me around the error. I hope this helps anyone else who stumbles upon this error. This is absolutely feels like a gross work around for someone else's bug. If anyone has a way to submit a bug to forcepoint, please do. |
I have no idea, but somehow it is fixed automatically after redeploy?! |
@spnc-omz that puts enough puzzle pieces in place that we might also be able to work around it on our side. Could you please give |
@phryneas I was able to give this a look in my project in safari and I'm no longer seeing the issue. I did have a few hiccups getting there because of the layers of abstraction provided by frameworks, but was able to verify. Thanks for getting around to this so quickly! y'all are awesome. |
@spnc-omz thank you for the feedback - I'm getting this released then :) |
Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Client usage and allow us to serve you better. |
And it's out with https://github.com/apollographql/apollo-client/releases/tag/v3.11.8 |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Issue Description
This is the stack trace caught by Sentry. We are observing this for a few users while using the Safari 17.2.1.
Link to Reproduction
I've included the stack trace above. We are unable to reproduce this ourselves, but we have Sentry capturing the stack trace with sourcemaps.
Reproduction Steps
No response
@apollo/client
version3.8.8
The text was updated successfully, but these errors were encountered: