Store error: the application attempted to write an object with no provided id but the store already contains an id of...
See original GitHub issueHey, Today in one of my applications I found this issue. I’m not sure if this is a bug or desired behaviour because I couldn’t find any information about it in the documentation.
The fix is quite easy, just add id
to the query
without id.
So the question is: should every query has defined id
for a resource?
It seems to work without id
but when there will be the next query with defined id
, this error appears.
I’m asking because I have a few other cases where external API doesn’t have id
so this problem can appear again in the future.
Intended outcome: Error shouldn’t appear and application should render data.
Actual outcome: Error appears
Network error: Error writing result to store for query
query PokemonQuery($id: ID) {
Pokemon(id: $id) {
name
url
createdAt
}
}
Store error: the application attempted to write an object with no provided
id but the store already contains an id of Pokemon:ciwnmyvxn94uo0161477dicbm
for this object.
How to reproduce the issue: https://codesandbox.io/s/mom8ozyy9
Check checkbox
in provided demo.
Version
- apollo-client@<1.6.0>
Issue Analytics
- State:
- Created 6 years ago
- Reactions:77
- Comments:62 (10 by maintainers)
Top Results From Across the Web
Apollo client is giving me an error of 'store already contains an ...
Possible Unhandled Promise Rejection (id: 0): Network error: Store error: the application attempted to write an object with no provided id but the...
Read more >The store already contains an id of - Questions - Prisma 1 Forum
Store error: the application attempted to write an object with no provided id but the store already contains an id of … for...
Read more >Require id field for all GraphQL entities in all queries ... - GitLab
Feature A's query now fails, with something like: Store error: the application attempted to write an object with no provided id but the...
Read more >Error Responses - Amazon Simple Storage Service
Error Code Description HTTP Status Code
AccessControlListNotSupported The bucket does not allow ACLs. 400 Bad Request
AccessDenied Access Denied 403 Forbidden
BucketAlreadyOwnedByYou 409 Conflict (in all...
Read more >Database Engine events and errors - SQL Server
223, 11, No, Object ID %ld specified as a default for table ID %ld, ... Data compression and vardecimal storage format are only...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey @hinok 👋
This error only should occur when you have made a query with an
id
field for a portion, then made another that returns what would be the same object, but is missing theid
field.We are planning on making this just a warning (instead of throwing) but it does help a lot to keep the
id
field included in queries that share fieldsYou may forgot to select
id
in your query.