【发布时间】:2020-06-09 01:23:15
【问题描述】:
我正在 Gatsby 中创建动态页面,从 Fauna 中提取数据。我在 gastby-node 中有一个查询抛出错误“必须提供源”,但该查询在 GraphiQL 中有效。我在下面包含了 gatsby-node.js。
exports.createPages = async function({actions, graphql}){
const {data} = await graphql`
query {
fauna {
allCompanies {
data {
slug
}
}
}
}
`
data.fauna.allCompanies.data.forEach(edge => {
const slug = edge.slug
actions.createPages({
path: slug,
component: require.resolve("./src/components/products.js"),
context:{
slug
},
})
})
}
【问题讨论】:
-
我们能看到错误信息吗?你确定它来自 GraphQL 查询吗?
标签: javascript reactjs gatsby