【发布时间】:2020-04-01 18:08:12
【问题描述】:
我有一个使用NextJS 和GraphQL 的项目。直到昨天一切正常。
对于GraphQL,我正在使用Apollo GraphQL
昨天我在 GraphQL 查询中添加了新字段 pageDescription,我需要从 review 获取该字段。这是GraphQL schema的一部分
"Field Group"
type Review_Review {
fieldGroupName: String
"Page description that will be displayed in Google search"
pageDescription: String
reviewProducts: [Review_Review_reviewProducts]
}
这是我的查询
export const single_review_query = gql`
query Review($slug: String) {
reviewBy(slug: $slug) {
content
title
featuredImage {
sourceUrl
}
author {
name
description
avatar(size: 32) {
url
}
avatar_big: avatar(size: 60) {
url
}
}
review {
pageDescription
reviewProducts {
products {
pros
title
price
notice
platform
link
grade
description
cons
image {
image {
sourceUrl
}
}
}
}
}
}
}
`
这个查询在开发模式下就像一个魅力。问题是当我在构建中运行它时。它只是行不通。控制台中没有任何内容。这是来自Networks 选项卡的错误
message: "Cannot query field "pageDescription" on type "Review_Review"."
category: "graphql"
当我从查询中删除 pageDescription 时一切正常
再次。 DEV 模式下不会发生这种情况
如果您需要更多信息,请写在 cmets 中。
谢谢。
编辑哦,是的。我忘了提。这是使用 Wordpress 的无头 CMS
【问题讨论】: