Gatsby-source-graphql требует указания опции `fieldName` - PullRequest
0 голосов
/ 11 марта 2020

Я пытаюсь запустить демонстрационное приложение, которое использует Хасуру и Гэтсби (https://github.com/praveenweb/dynamic-jamstack-gatsby-hasura/tree/master/dynamic-auth-client).

Я отредактировал файл gatsby-config. js с моей конечной точкой Hasura URL, но я получаю следующую ошибку.

ERROR 

UNHANDLED REJECTION Type HASURA must define one or more fields.

  Error: Type HASURA must define one or more fields.

gatsby-config. js

module.exports = {
  siteMetadata: {
    title: "projectname",
    siteUrl: `https://www.myurlhere.com`,
  },
  plugins: [
    `gatsby-plugin-react-helmet`,
    `gatsby-plugin-sitemap`,
    {
      resolve: `gatsby-plugin-nprogress`,
      options: {
        // Setting a color is optional.
        color: `tomato`,
        // Disable the loading spinner.
        showSpinner: false,
      },
    },
    {
      resolve: "gatsby-source-graphql",
      options: {
        typeName: "HASURA",
        fieldName: "hasura",
        url: "https://myurlhere.com/v1/graphql",
      },
    },
  ],
}

1 Ответ

1 голос
/ 11 марта 2020

Я обнаружил, что мне нужно только указать typeName: "Query" и fieldName: "blah".

Ошибка: нарушение инварианта: gatsby-source-graphql требует, чтобы параметр `typeName` был указано

{
 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
 },
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...