question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Store error: the application attempted to write an object with no provided id but the store already contains an id of...

See original GitHub issue

Hey, 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:closed
  • Created 6 years ago
  • Reactions:77
  • Comments:62 (10 by maintainers)

github_iconTop GitHub Comments

270reactions
jbaxleyiiicommented, Nov 13, 2017

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 the id 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 fields

70reactions
WilledgeRcommented, Jul 3, 2018

You may forgot to select id in your query.

                post(id: $postID) {
                    id
                    comments(pagination: $pagination) {
                        edges {
                            node {
                                content
                            }
                            cursor
                        }
                        pageInfo {
                            endCursor
                        }
                    }
                }
            }```
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found