gatsby: Direct-ID lookup for nodes in graphql fails in some instances
Description
When querying a single node by a direct-ID lookup, the query sometimes returns null. Querying for the whole list, and filtering by something such as slug finds the document fine, with the same ID.
Thanks to @DSchau for helping me debug this.
I had a feeling it was related to https://github.com/gatsbyjs/gatsby/issues/20609, but after testing on a version from before that change (2.18.22), the issue still occurs.
Steps to reproduce
I have no idea how to reliably reproduce this sorry. It has randomly occurred on my project. It appears to just be the one node, on a page with >10k pages (so therefore a lot of nodes are in the db)
This query on the site shows it in a simple way, however.
Expected result
The contentfulBlogPost
query should be able to find a node, as the above query has proven it exists and provided an ID.
Actual result
A direct-ID lookup for this object does not work. Looking up by other things, such as contentful_id, do work.
Environment
System:
OS: macOS 10.15.3
CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.14.1 - ~/.npm/bin/node
Yarn: 1.22.0 - ~/.npm/bin/yarn
npm: 6.13.6 - ~/.npm/bin/npm
Languages:
Python: 2.7.17 - /usr/local/bin/python
Browsers:
Firefox: 70.0.1
Safari: 13.0.5
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 3
- Comments: 24 (19 by maintainers)
So we’ve had this occur again in a way that cannot be worked around.
Using contentful, rich text fields are a separate node, accessed through
content___NODE
. Direct ID lookups are failing for some of these, and therefore thecontent___NODE
field comes up asnull
.I understand this is almost impossible to debug without a minimal reproduction, however I have not been able to create one reliably. The best I can do is using the exact same data so that the node store is in the same state. However this is still not minimal and is very intertwined with systems that can’t easily be shared.
I’m happy to debug and solve this, my main reason for asking again now is to work out if anyone on the Gatsby team has any ideas about what areas of the codebase could cause something like this. I’ve been looking into it for a few days and haven’t been able to find a concrete cause.