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.

Direct-ID lookup for nodes in graphql fails in some instances

See original GitHub issue

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.

image

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:24 (19 by maintainers)

github_iconTop GitHub Comments

1reaction
me4502commented, Apr 21, 2020

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 the content___NODE field comes up as null.

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.

0reactions
github-actions[bot]commented, Jul 3, 2020

Hey again!

It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else. As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks again for being part of the Gatsby community! 💪💜

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error handling - Apollo GraphQL Docs
Code, Description. GRAPHQL_PARSE_FAILED. The GraphQL operation string contains a syntax error. GRAPHQL_VALIDATION_FAILED. The GraphQL operation is not valid ...
Read more >
Query users with GraphQL - GitLab Docs
The example users query looks for a subset of users in o a GitLab instance either by username or Global ID. The query...
Read more >
Getting multiple instances of graphql error despite only having ...
I have traced this error back to assertSchema in src/type/schema.js, which calls the util function instanceOf Which is exactly the function that ...
Read more >
GraphQL error handling to the max with Typescript, codegen ...
As an example, you can check out graphql-helix implementation of some error cases' responses with different Status Codes, ...
Read more >
How to Add File Upload to Your GraphQL API - Level Up Coding
GraphQL APIs can use any database systems since it only changes the API layer. The logic underneath is still the same as a...
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