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.

gatsby-source-wordpress Not reflecting changes from the WP GQL

See original GitHub issue

Description

Not seeing changes on the local Gatsby GraphQL. Images object returning null instead.

Steps to reproduce

WP GQL Query:

query MyQuery {
  page(id: "cG9zdDoxMTA2NzA=") {
    id
    title
    generalModulesGroup {
      modules {
        ... on Page_Generalmodulesgroup_Modules_VerticalImageFeaturedModule {
          description
          images {
            horizontal {
              sourceUrl
            }
            vertical {
              sourceUrl
            }
          }
        }
      }
    }
  }
}

Gatsby GQL Query:

query MyQuery {
  wpPage(id: {eq: "cG9zdDoxMTA2NzA="}) {
    id
    title
    generalModulesGroup {
      modules {
        ... on WpPage_Generalmodulesgroup_Modules_VerticalImageFeaturedModule {
          description
          images {
            horizontal {
              sourceUrl
            }
            vertical {
              sourceUrl
            }
          }
        }
      }
    }
  }
}

Expected result

Expecting the same data as on WP GQL Query.

{
  "data": {
    "page": {
      "id": "cG9zdDoxMTA2NzA=",
      "title": "Accueil",
      "generalModulesGroup": {
        "modules": [
          {
            "description": "<p>Nos produits sont fabriqués avec le concept exclusif de transport des nutriments (NTC®) qui fournit les nutriments exactement quand ils sont nécessaires et où ils sont nécessaires – au niveau cellulaire, de l&#8217;intérieur et de l&#8217;extérieur.</p>\n",
            "images": {
              "horizontal": {
                "sourceUrl": "mydomain.com/wp-content/uploads/2021/05/2020.08.07_SPP70717-aspect-ratio-328-186.jpg"
              },
              "vertical": {
                "sourceUrl": "mydomain.com/wp-content/uploads/2021/05/pic1-os.jpg"
              }
            }
          },
          {},
          {},
          {},
          {},
          {},
          {},
          {},
          {}
        ]
      }
    }
  }
}

Actual result

Got null on images (Gatsby GQL Query).

{
  "data": {
    "wpPage": {
      "title": "Accueil",
      "generalModulesGroup": {
        "modules": [
          {
            "description": "<p>Nos produits sont fabriqués avec le concept exclusif de transport des nutriments (NTC®) qui fournit les nutriments exactement quand ils sont nécessaires et où ils sont nécessaires – au niveau cellulaire, de l&#8217;intérieur et de l&#8217;extérieur.</p>\n",
            "images": {
              "horizontal": null,
              "vertical": null
            }
          },
          {},
          {},
          {},
          {},
          {},
          {},
          {},
          {}
        ]
      }
    }
  }
}

Environment


  System:
    OS: macOS 11.3.1
    CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.17.0 - ~/.nvm/versions/node/v14.17.0/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.13.0 - ~/.nvm/versions/node/v14.17.0/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Chrome: 90.0.4430.212
    Edge: 90.0.818.51
    Firefox: 87.0
    Safari: 14.1
  npmPackages:
    gatsby: ^3.5.1 => 3.5.1 
    gatsby-plugin-env-variables: ^2.1.0 => 2.1.0 
    gatsby-plugin-gatsby-cloud: ^2.5.0 => 2.5.0 
    gatsby-plugin-gdpr-cookies: ^2.0.0 => 2.0.0 
    gatsby-plugin-image: ^1.5.0 => 1.5.0 
    gatsby-plugin-manifest: ^3.5.0 => 3.5.0 
    gatsby-plugin-react-helmet: ^4.4.0 => 4.4.0 
    gatsby-plugin-robots-txt: ^1.6.2 => 1.6.2 
    gatsby-plugin-root-import: ^2.0.6 => 2.0.6 
    gatsby-plugin-sass: ^4.5.0 => 4.5.0 
    gatsby-plugin-sharp: ^3.5.0 => 3.5.0 
    gatsby-plugin-transition-link: ^1.20.5 => 1.20.5 
    gatsby-plugin-typegen: ^2.2.4 => 2.2.4 
    gatsby-source-filesystem: ^3.5.0 => 3.5.0 
    gatsby-source-wordpress: ^5.5.1 => 5.5.1 
    gatsby-transformer-sharp: ^3.5.0 => 3.5.0 

Gatsby config for gatsby-source-wordpress plugin:

{
    resolve: 'gatsby-source-wordpress',
    options: {
        url: process.env.WORDPRESS_GRAPHQL_URL,
        debug: {
            timeBuildSteps: true,
            throwRefetchErrors: true,
            graphql: {
                showQueryOnError: true,
            },
        },
        production: {
            hardCacheMediaFiles: true,
            allow404Images: true,
        },
        develop: {
            hardCacheMediaFiles: true,
            hardCacheData: true,
        },
        schema: {
            perPage: 50,
            requestConcurrency: 3,
            previewRequestConcurrency: 2,
            timeout: 60000,
        },
        html: {
            useGatsbyImage: false,
            createStaticFiles: false,
        },
        type: {
            Category: {
                exclude: true,
            },
            Comment: {
                exclude: true,
            },
            Menu: {
                exclude: true,
            },
            MenuItem: {
                exclude: true,
            },
            ContentType: {
                exclude: true,
            },
            User: {
                exclude: true,
            },
            UserRole: {
                exclude: true,
            },
            Taxonomy: {
                exclude: true,
            },
            Tag: {
                exclude: true,
            },
            PostFormat: {
                exclude: true,
            },
            Post: {
                exclude: true,
            },
            MediaItem: {
                localFile: {
                    requestConcurrency: 3,
                },
            },
        },
    },
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
benrobertsoniocommented, Jun 17, 2021

Just jumping in to say we’ve got a testing environment from @ardiewen and will do some investigation on our side cc @TylerBarnes

1reaction
igorbumbacommented, Jun 7, 2021

@TylerBarnes for all images in that field, as shown in the first post.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Wordpress updates are not picked up by gatsby-develop ...
After upgrade to 6.0.0 (gatsby latest version. also upgraded all the required wordpress plugins to the latest), the updates are not reflected in ......
Read more >
Gatsby-Wordpress GraphQL does not update data when ...
I have used WordPress for posting blogs for website and I'm fetching blogs using GraphQL. Everything is working fine, and I deployed the...
Read more >
Troubleshooting Common Errors - Gatsby
comes up when a GraphQL query is trying to query a field for subfields, but none exist. This generally happens when plugins that...
Read more >
Gatsby for beginners | Wordpress as a headless CMS - YouTube
Gatsby is using React (ReactJS) and GraphQL to create static sites that's blazing fast.Learn how to combine Gatsby.js with Wordpress as a ...
Read more >
Making GraphQL Work In WordPress - Smashing Magazine
The reason is that only WPGraphQL has the Gatsby source plugin for WordPress. In addition, WPGraphQL's creator, Jason Bahl, was employed ...
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