Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gatsby custom schema API fails with Contentful multi reference #12787

Closed
sami616 opened this issue Mar 23, 2019 · 6 comments · Fixed by #12806
Closed

Gatsby custom schema API fails with Contentful multi reference #12787

sami616 opened this issue Mar 23, 2019 · 6 comments · Fixed by #12806

Comments

@sami616
Copy link

sami616 commented Mar 23, 2019

Description

The new Gatsby customize schema API returns null on multi reference fields when used with gatsby-source-contentful even when the field is populated

In this case specifically the sections field:

    type ContentfulPage implements Node {
      title: String
      slug: String
      sections: [ContentfulSection] <-- null
    }

Steps to reproduce

  1. clone: git clone https://github.com/sami616/gatsby-contentful-custom-schema-bug.git
  2. yarn install
  3. yarn start

Expected result

A list of data should render under the page title

Actual result

Nothing renders because the field sections is null despite data being available in Contentful.

Environment

System:
OS: macOS 10.14
CPU: x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.10.0 - ~/.nvm/versions/node/v10.10.0/bin/node
Yarn: 1.10.1 - ~/.nvm/versions/node/v10.10.0/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v10.10.0/bin/npm
Browsers:
Chrome: 73.0.3683.86
Firefox: 62.0.3
Safari: 12.0
npmPackages:
gatsby: ^2.2.8 => 2.2.8
gatsby-plugin-react-helmet: ^3.0.0 => 3.0.0
gatsby-source-contentful: ^2.0.42 => 2.0.42
gatsby-transformer-remark: ^2.1.7 => 2.1.7
npmGlobalPackages:
gatsby-cli: 2.4.3

@sami616 sami616 changed the title Gatsby custom schema API with Contentful Gatsby custom schema API fails with Contentful multi reference Mar 23, 2019
@stefanprobst
Copy link
Contributor

@sami616 Thanks for reporting! Would you be able to test if #12806 fixes the issue for you?

@sami616
Copy link
Author

sami616 commented Mar 25, 2019

Thanks @stefanprobst, whats the best way for me to test? can i install this specific PR?

@wardpeet
Copy link
Contributor

it's available in the latest gatsby version (2.2.10) :)

@sami616
Copy link
Author

sami616 commented Mar 25, 2019

@stefanprobst @wardpeet i have discovered the same problem seems to be affecting unions, when a field is referencing an array of multiple types and one of the types is missing i'm always getting null

Could this be linked to PR #12816

@stefanprobst
Copy link
Contributor

@sami616 The PR you linked to is not merged yet, so the issue must lie somewhere else. Would you be able to open a new bug report (and if possible adjust the reproduction repo)? That would be very helpful thanks!

@sami616
Copy link
Author

sami616 commented Mar 25, 2019

no prob @stefanprobst #12832

same repo, hopefully that makes sense - shout if not!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants