Error: Invariant Violation: gatsby-source-graphql requires option `typeName` to be specified

橙三吉。 提交于 2021-01-29 07:31:45

问题


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
  },

回答1:


`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
},

Below worked fine

{
  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
 },


来源:https://stackoverflow.com/questions/55355700/error-invariant-violation-gatsby-source-graphql-requires-option-typename-to

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!