错误:始终违规:gatsby-source-graphql需要指定选项`typeName` [英] Error: Invariant Violation: gatsby-source-graphql requires option `typeName` to be specified

查看:54
本文介绍了错误:始终违规:gatsby-source-graphql需要指定选项`typeName`的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是GatsbyJs的新手-GraphQL,我一直在探索gatsby提供的示例(

I am new to GatsbyJs - GraphQL, I have been exploring the example provided by gatsby(https://github.com/gatsbyjs/gatsby/tree/master/examples/using-gatsby-source-graphql), As I tried with local apollo-grapql server, It returns data in the front-end, However it throws above error and blocks the build process, not sure what exactly is typeName I need to pass it in here? any help one this would be much appreciated.

    `gatsby-source-graphql`,
    {
      resolve: "gatsby-source-graphql",
     options: {
      // This type will contain remote schema Query type
      typeName: "Query",
      // This is field under which it's accessible
      fieldName: "blah",
      // Url to query from
      url: "http://10.113.34.59:4000/graphql",
      // this is URL where served exposed its service in local
  },

推荐答案

`gatsby-source-graphql`, <==== this caused the issue
{
  resolve: "gatsby-source-graphql",
 options: {
  // This type will contain remote schema Query type
  typeName: "Query",
  // This is field under which it's accessible
  fieldName: "blah",
  // Url to query from
  url: "http://10.113.34.59:4000/graphql",
  // this is URL where served exposed its service in local
},

以下工作正常

{
  resolve: "gatsby-source-graphql",
 options: {
  // This type will contain remote schema Query type
  typeName: "Query",
  // This is field under which it's accessible
  fieldName: "blah",
  // Url to query from
  url: "http://10.113.34.59:4000/graphql",
  // this is URL where served exposed its service in local
 },

这篇关于错误:始终违规:gatsby-source-graphql需要指定选项`typeName`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆