Reputation:
I am trying to get a demo app that uses Hasura and Gatsby started (https://github.com/praveenweb/dynamic-jamstack-gatsby-hasura/tree/master/dynamic-auth-client).
I edited the gatsby-config.js file with my Hasura endpoint URL, but I get the following error.
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",
},
},
],
}
Upvotes: 2
Views: 351
Reputation:
I found I only need to make the typeName: "Query" and the fieldName: "blah".
Error: Invariant Violation: gatsby-source-graphql requires option `typeName` to be specified
{
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
},
Upvotes: 2