Graphql 盖茨比输入查询编译时出错

Graphql 盖茨比输入查询编译时出错,graphql,gatsby,Graphql,Gatsby,我有一个GraphQL查询,我可以使用GraphQL完美地运行它 然而,当我把它放在盖茨比页面中时,它抛出了一个错误,并且没有给出进一步的诊断 export const query = graphql` query($path: String!) { cms { headerActions: callToActions( where: { placement: Header, AND: { pages_some: { path: $path } } }

我有一个GraphQL查询,我可以使用GraphQL完美地运行它

然而,当我把它放在盖茨比页面中时,它抛出了一个错误,并且没有给出进一步的诊断

export const query = graphql`
  query($path: String!) {
    cms {
      headerActions: callToActions(
        where: { placement: Header, AND: { pages_some: { path: $path } } }
      ) {
        url
        label
      }
    }
  }
`
错误:

error GraphQL Error Expected a value matching type `[CMS_CallToActionWhereInput!]`, but got an object value

我甚至不知道该往哪个方向挖掘,因为盖茨比没有给出错误详细信息。

错误表明它需要一个数组,但我在您的
calToAction
查询中没有看到任何数组,我想这可能会解决您的问题:

export const query = graphql`
  query($path: String!) {
    cms {
      headerActions: callToActions(
        where: [ { placement: Header, AND: { pages_some: { path: $path } } } ]
      ) {
        url
        label
      }
    }
  }
`

好的,在您的帮助下解决了这个问题:where:{placement:Header,AND:[{pages\u some:{path:$path}]}然后将其简化为where:{placement:Header,pages\u some:{path:$path}}谢谢!