gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.27k stars 10.31k forks source link

New schema not showing on http://localhost:8000/___graphql #30856

Closed LaikaTheSpaceDog closed 2 years ago

LaikaTheSpaceDog commented 3 years ago

Description

I'm just setting up my Wordpress as a data source for Gatsby. I have all my GraphQL plugins up and running on my local wordpress site, but now I'm trying to use the gatsby-source-graphql plugin in my Gatsby project but without success. I have installed the plugin and added the following code to my gatsby-config.js file:

module.exports = {
  plugins: [
    // Simple config, passing URL
    {
      resolve: "gatsby-source-graphql",
      options: {
        typeName: "WPGraphQL",
        fieldName: "wpgraphql",
        url: "http://site.test/graphql",
        refetchInterval: 60
      },
    },
  ],   
}

However, when I try and run npm run develop, the local site spins up as expected but I get the following errors:

ERROR #11321  PLUGIN
"gatsby-source-graphql" threw an error while running the sourceNodes lifecycle:
warn The gatsby-source-graphql plugin has generated no Gatsby nodes. Do you need it?

And when I navigate to http://localhost:8000/___graphql, I am not given wpgraphql as a fieldName in the column on the left.

Steps to reproduce

See above

https://github.com/LaikaTheSpaceDog/gatsby-debug

Expected result

There should be a field/schema in my http://localhost:8000/___graphql called wpgraphql that allows me to query my Wordpress environment.

Actual result

The field/schema does not display and the above error messages display in the console.

Environment

System: OS: macOS Mojave 10.14.6 CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz Shell: 3.2.57 - /bin/bash Binaries: Node: 14.15.4 - /usr/local/bin/node npm: 6.14.10 - /usr/local/bin/npm Languages: Python: 2.7.16 - /usr/bin/python Browsers: Chrome: 89.0.4389.114 Safari: 14.0.3 npmPackages: gatsby: ^3.2.1 => 3.2.1 gatsby-source-graphql: ^3.2.0 => 3.2.0 npmGlobalPackages: gatsby-cli: 3.2.0

vladar commented 3 years ago

The endpoint in your example is set to http://meraki.fanatic/graphql - is it some local site? Any hints on how I can run this example on my machine?

LaikaTheSpaceDog commented 3 years ago

Hi @vladar , apologies for not explaining properly. http://meraki.fanatic is a local Wordpress site that I have set up, which has the WP GraphQL, WP GraphiQL and WPGraphQL for Advanced Custom Fields all set up and running as expected, with http://meraki.fanatic/graphql as the Wp GraphQL endpoint. I'm using XAMPP as a local server for my Wordpress site.

vladar commented 3 years ago

I see. Maybe you have this test schema exposed somewhere on the internet? Local WP will require some time to set up for me. Alternatively - can you try your repro with some public GraphQL schema? Maybe it is not related to WP at all and fails on any schema.

LaikaTheSpaceDog commented 3 years ago

@vladar I have now tried it with a public schema (https://metaphysics-production.artsy.net/) and I'm still unable to access it through localhost:8000/___graphql. However, I no longer get the ERROR #11321 in the terminal.

LaikaTheSpaceDog commented 3 years ago

Update: I have tried again using a public schema and I'm getting the following error message:

 ERROR #11321  PLUGIN

"gatsby-source-graphql" threw an error while running the sourceNodes lifecycle:

Source GraphQL API: HTTP error 404 Not Found

  Error: Source GraphQL API: HTTP error 404 Not Found

  - fetch.js:11 exports.fetchWrapper
    [portfolio-gatsbyu-master]/[gatsby-source-graphql]/fetch.js:11:11

  - task_queues.js:93 processTicksAndRejections
    internal/process/task_queues.js:93:5
graysonhicks commented 3 years ago

👋 @LaikaTheSpaceDog Do you still have a reproduction of this? The one above seems to have been removed and the https://metaphysics-production.artsy.net/ link doesn't seem to be a GraphQL endpoint for me. Thanks!

LekoArts commented 2 years ago

Hi!

Since we didn't receive an answer for 7 days or more about the ask of a reproduction I'm going to close this now, as we can't do much to help without a reproduction. If you are able to create a minimal reproduction for this then please do answer here or open a new issue with a reproduction. Thanks!