-
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
Can't find field on ROOT_QUERY object error on 3.4.x and up #8593
Comments
@hueter I believe this may be a consequence of #8262, which came before #8422 (though that's a reasonable suspect too). The motivation for #8262 was to avoid situations where both Can you tell where the error is actually logged/thrown? The stack trace attached to the error shows where the |
hi @benjamn thanks for the reply and context. For context, yes we usually throw errors that come from apollo queries and catch them with parent error boundary components like so: |
On a different note, I'm also curious to figure out why the field was missing in the first place. Do you see any keys starting with |
In case this is useful, you can control the serialization of the new InMemoryCache({
typePolicies: {
Query: {
fields: {
contactsCollection: {
// Use keyArgs to configure args serialization:
keyArgs: ["params", ["order"]], // Serialize only args.params.order, not limit or offset
keyArgs: false, // Disables the serialization, so the key is just contactsCollection
},
},
},
},
}) However, I should also mention these |
Ah interesting, thank you for the insight! I guess it's a tough call from the API design perspective, but as an end user I was expecting I also just tested the code and setting the query's I'll have to read up on the caching serialization to see if that could provide an alternative as well. Thanks for the follow-up! This has been helpful. |
Related: #8442 I’m also seeing transitory Missing Cache Field errors on the error property in unit tests while refactoring code. A potential option might be to make these console warnings only. |
@brainkim I've got an idea for a PR to handle this, coming shortly! |
Should fix #8593, which suggests including `MissingFieldError`s in `result.error` was more disruptive than helpful.
Should fix #8593, which suggests including `MissingFieldError`s in `result.error` was more disruptive than helpful.
Should fix #8593, which suggests including `MissingFieldError`s in `result.error` was more disruptive than helpful.
Hello,
After upgrading to 3.4.x, I have had problems with certain queries being reissued with different variables resulting in an Apollo error that crashes my app.
Intended outcome:
useQuery
can be re-executed multiple times with different variables and not crash.Actual outcome:
This crash happens:
Following the traceback, I placed a debugger in
ObservableQuery
atgetCurrentResult
:Note that the network request worked and the backend resolved the query successfully:
How to reproduce the issue:
I am having a lot of difficulty reproducing the error in the sandbox, but here's a bunch of things that I tried / additional information:
fetchPolicy: 'network-only'
andnextFetchPolicy: 'network-only'
refetch
with new variables or the same query with new variablesskip: true
and only usingrefetch
and it still happenedVersions
I reproduced this error on the following:
However downgrading to 3.3.21 fixed the issues.
Additional Notes
I'm wondering if this could possibly be related to #8422 because it touched the file where I'm getting the error.
Please let me know if there's anything to try or if any additional info would be helpful.
The text was updated successfully, but these errors were encountered: