I am usingGatsby with GraphQL. Getting unknown field error as follows:
GraphQL Error Encountered 2 error(s):
- Unknown field 'allBlogPost' on type 'Query'. Source: document `homeAymanDesktopFirstSrcPagesIndexJs2258072279` file: `GraphQL request`
GraphQL request:3:3
2 | {
3 | posts: allBlogPost {
| ^
4 | nodes {
- Unknown field 'blogPost' on type 'Query'.
file: /home/ayman/Desktop/first/src/templates/post.js
Here is my post.js template file:
import React from "react"
import { graphql } from "gatsby"
export default ({ data }) => {
console.log(data)
return (
<div>
<h1>{data.post.title}</h1>
<div dangerouslySetInnerHTML={{ __html: data.post.html }} />
</div>
)
}
export const query = graphql`
query($id: String!) {
post: blogPost(id: { eq: $id }) {
title
html
}
}
`
My gatsby-node.js configuration can be found in this pastebin
My GraphiQL:
Update
After adding Asciidoc file in content/posts and content/articles , getting this error:
Cannot query field "slug" on type "BlogPost".
File: gatsby-node.js:89:16
ERROR #11321 PLUGIN
"gatsby-node.js" threw an error while running the createPages lifecycle:
Cannot read property 'posts' of undefined
TypeError: Cannot read property 'posts' of undefined
- gatsby-node.js:99
