I have some issues with my code, I'm working with Gatsby and Gatsby Awesome Pagination,
So I don't know what is going on, because on gatsby develop is working but when I use
gatsby build it says
There was an error in your GraphQL query: Variable "$id" of required type "Int!" was not provided.
This is my code in gatsby-node.js
const BlogPosts = result.data.allWordpressPost.edges
paginate({
createPage,
items: BlogPosts,
itemsPerPage: 10,
itemsPerFirstPage: 10,
pathPrefix: '/blog',
component: path.resolve('./src/pages/blog.js'),
})
BlogPosts.forEach(post => {
createPage({
path: `/${post.node.slug}`,
component: BlogSinglePage,
context: {
id: post.node.wordpress_id,
},
})
})
And this is my code in Blog.js
export const query = graphql`
query ($skip: Int!, $limit: Int!) {
allWordpressPost(
skip: $skip
limit: $limit
)
{
edges {
node {
wordpress_id
title
excerpt
slug
date(formatString: "YYYY-MM-DD")
categories {
name
slug
}
featured_media {
source_url
}
}
}
}
}
`
Can you please tell me what I'm doing wrong
Thanks !!!
Isn't your "Blog.js" in "src/pages"?
as Gatsby core automatically turns react components in "src/pages" into pages with urls, I recommend that you move your "Blog.js" to "src/templates"