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.

GraphQL. DRAFT references cause errors on nullable fields

See original GitHub issue

Expected Behavior

DRAFT as Reference should be ignored by graphQL on nullable fields.

Actual Behavior

Adding a DRAFT as Reference causes an error and prevents loading data.

Using: useQuery via @apollo/client or graphiql via{SPACE}

"errors": [
      "message": "Query execution error. Link to entry '{ENTRY_ID}' on field '{FIELD_NAME}' within type '{CONTENT_TYPE}' cannot be resolved",
      "extensions": {
        "contentful": {
          "code": "UNRESOLVABLE_LINK",
          "requestId": "{REQUEST_ID}",
          "details": {
            "type": "{CONTENT_TYPE}",
            "field": "{FIELD_NAME}",
            "linkType": "Entry",
            "linkId": "{ENTRY_ID}"
      "locations": [
          "line": 156,
          "column": 9
      "path": [

Partial data exists on graphiql via{SPACE} but it won’t be returned by @apollo/client.


Possible Solution

Removing the DRAFT works but is (probably) not the intended behavior

Steps to Reproduce

  1. Add a DRAFT as Reference
  2. Query the contentType via{SPACE}
  3. See error


When changing a published entry to DRAFT the page cannot be loaded. This can cause unexpected behavior and should be considered a showstopper.

Partial data exists on graphiql via{SPACE} but it won’t be returned by @apollo/client.

If this is considered an @apollo/client issue please mention it in a comment so I can create an issue and link it. Maybe @apollo/client does not return data when an error is present. The error is unnecessary and IMHO a bug.


  • Language Version: v12.15.0
  • Package Manager Version: 6.13.4
  • Operating System: 19.5.0 Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64 x86_64
  • Package Version: n.a.
  • Which API are you using?: GraphQL

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:6
  • Comments:13

github_iconTop GitHub Comments

hugomncommented, Feb 10, 2021

Hey, this issue is causing us some troubles, using GraphQL Api. I know we can filter or ignore the errors, but what about the null entries? For example when we have an entry with linked entries, and some of then are still in draft mode, we get something like this:

  { sys: { id: <id> } },
  { sys: { id: <id> } },
  { sys: { id: <id> } }

Which is very annoying and error-prone when we use indexing of the items to track order, for example. And as far as I understood, the option removeUnresolved is not available in the GraphQL Api. Any other way of fixing this?

lucashfreitascommented, Jul 7, 2021

I am having the same issue - it’s strange - why the graphql api returns NULL fields in draft items instead of just not returning them? Since we have preview tokens for that purposes it would not make sense to always hide draft items? @pixelass

As @hugomn mentioned a lot of my queries are also returning this data structure:

  { sys: { id: <id> } },
  { sys: { id: <id> } },
  { sys: { id: <id> } }

So I am having to do a lot of data.filter(x=>x) as a workaround for this issue.

@hugomn did you find any solution for that?


Read more comments on GitHub >

github_iconTop Results From Across the Web

Using nullability in GraphQL
A field can either be nullable or non-null, and this tells you whether or not you could receive a null value when you...
Read more >
Why does a GraphQL query return null? - Stack Overflow
There's two common reasons your field or fields are resolving to null: 1) returning data in the wrong shape inside your resolver; ...
Read more >
Nulls in GraphQL: Cheatsheet - Hasura
Nullability in GraphQL is a controversial topic. Some say constant null checks are a nuisance, while others err on the side of paranoia....
Read more >
Working Draft - GraphQL
Fields in the top-level selection set of an operation often represent some information that is globally accessible to your application and its current...
Read more >
GraphQL Content Delivery API for Developers - Contentstack
Using it, you can skip the content type(s) causing the schema build error ... Their GraphQL type names are reserved and any user-defined...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found