GraphQL“ $ id”的必需类型为“ Int!”未提供

问题描述 投票:0回答:1

我的代码有问题,我正在使用Gatsby和Gatsby Awesome分页,

所以我不知道发生了什么,因为在[[gatsby development上正在工作,但是当我使用时

gatsby build

它说

GraphQL查询中存在错误:所需类型为“ Int!”的变量“ $ id”未提供。

这是我在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, }, }) })

这是我在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 } } } } } `

你能告诉我我在做什么错

谢谢!!!

graphql gatsby
1个回答
0
投票
不是“ src /页面”中的“ Blog.js”吗?
© www.soinside.com 2019 - 2024. All rights reserved.