-
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
bad string formatting when constructing error - "Cannot convert object to primitive value" #11639
Comments
Hey @andreimatei 👋 We have a few errors in the code base that are converted using substitution, so its very possible there is one out there that isn't substituted properly. It's a bit difficult to tell where in the code base this is though without more information. Are you able to figure out what triggered this error? Unfortunately I'm not sure the stack trace has enough information to know where this is triggered from 😕 |
I can tell you that with the Chrome debugger, I see that the message of the error contains a stack:
Maybe the |
The respective line from
|
Awesome, that Would you mind turning on dev messages and seeing if perhaps one of those values is not a type we expect? import { loadErrorMessages, loadDevMessages } from "@apollo/client/dev";
if (__DEV__) {
loadDevMessages();
loadErrorMessages();
} If not, perhaps adding a breakpoint in that code and inspecting the values passed to |
It happened to us when there was no merge function and the items had no "id" key. {
__typename: "a",
id: 1,
arrayOfSomething : {
__typename: "b",
something: "foo",
anotherthing: "bar",
},
} When merging those |
I believe that, for some reason, Vite was using an old version of Apollo Client (different from the version in my Apologies for the noise... Closing. |
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. |
This is not fixed, as @Titozzz said it's still happening. |
@adrienharnay @Titozzz which version of Apollo Client are you using? |
We're on 3.8.7 and plan to update to latest next week (but I don't believe this has been fixed since, though I may be wrong). |
@adrienharnay it does look like we had a fix specifically for the cache override warning in #11483 which was released in 3.8.10. Could you try a quick test by upgrading to 3.8.10 and seeing if the issue goes away? |
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. |
Hi @jerelmiller I am still facing this issue with 3.9.9. It currently throws an error and breaks caching entirely Seems to be related to hidden attributes inside of the incoming/existing objects |
@Netail I'm trying to reproduce your situation here, but I'm not really getting anywhere. Do you maybe have some script in place in your application or a browser extension that wraps What happens if you execute |
@phryneas the custom console log works both in the browser and when I add it manually in before the other log in |
@Netail huh, very weird. But that's valuable feedback, too. Thanks! I'll keep digging |
I'll try to set up a demo, if I somehow able to reproduce it |
@Netail I've done my best to reproduce your error, but I cannot. Could you take a look at this CodeSandbox and report back if you are getting the error in any scenario? Load the Sandbox first: https://codesandbox.io/p/sandbox/trigger-cache-warning-cltdvn Then visit the standalone Sandbox: Scenarios to check:
|
We've been seeing these for a number of array queries in our platform as well -- I'm having a hard time reproducing in a sandbox but there is some issue with objects that don't like having .join called on them |
I am seeing it too. In my case, I used Chrome debugger and the error comes from here: https://github.com/apollographql/apollo-client/blob/main/src/cache/inmemory/writeToStore.ts#L853 I have the error because both
This change fixes it in my case. I created a PR. |
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
I think there's a bug on some code path that's trying to construct an error. Looks similar too what was fixed in #11516, but I'm running 3.9.5 which should have that fix.
I see:
The underlying error returned by the server is
the requested element is null which the schema does not allow
.Link to Reproduction
Reproduction Steps
No response
@apollo/client
version3.9.5
The text was updated successfully, but these errors were encountered: