GraphQL Node type not found

Hello,

I’m very new to GraphQL so there’s a good chance I’m doing something wrong here but I’m having issues with my GraphQL query. Here’s a basic example of what I use in the playground:

query {
  allBlogArticles {
    id
    title
  }
}

and that returns the ids and titles without any problems. However, when I run the query from my code I keep getting an error Node type not found for 'allBlogArticles'. If I run this query from my code:

query {
  blogArticle {
    id
    title
  }
}

that works fine to return a single record but the issue seems to be with multiple records.

Does anyone have any thoughts of what is going wrong?

Thanks!

Although just checked with curl and it works

curl 'https://graphql.datocms.com/preview' \
    -H 'Authorization: XXXXXXXXXXX' \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    --data-binary '{ "query": "query { allBlogArticles { title } }" }'

I’m using this gem to run the queries so something must be going wrong from there.

So it turns out that it was a specific issue to the gem I was using. When running my queries previous I was using execute whereas if you run the bang version execute! (doesn’t validate the query) then it works fine and I get back all of the data.

1 Like

Okay, I’m loving GraphQL! We are exploring moving our existing 450 or so blog articles from our Middleman code base into DatoCMS. I initially started with the gem for Middleman but was finding it was quite slow for the volume of content we have. I dropped that and started to pull the content in with GraphQL and it is rapid!

Now I’m getting my head around fragments, etc it’s really nice to use. The API Explorer is really handy as well to build out the fragments and then I can get them in the format for the ruby gem.

1 Like