robmarshall / gatsby-plugin-gravity-forms

A component to take GraphQl Gravity Forms query data and return a usable form
GNU General Public License v3.0
13 stars 13 forks source link

Unknown type "WpGravityFormsForm" #1

Closed steelbridge-io closed 2 years ago

steelbridge-io commented 2 years ago

Hello,

I am experiencing an issue where the graphiql queries and not matching what is in the localhost:8000/__graphiql

Trying on a plain defualt Gatsby install.

There was an error in your GraphQL query:

Unknown type "WpGravityFormsForm".

GraphQL request:2:33
1 |
2 |   fragment GravityFormFields on WpGravityFormsForm {
  |                                 ^
3 |     formId

Here's my package.json

{
  "name": "test",
  "version": "1.0.0",
  "private": true,
  "description": "test",
  "author": "steelbridge-io",
  "keywords": [
    "gatsby"
  ],
  "scripts": {
    "develop": "gatsby develop",
    "start": "gatsby develop",
    "build": "gatsby build",
    "serve": "gatsby serve",
    "clean": "gatsby clean"
  },
  "dependencies": {
    "@mdx-js/mdx": "^1.6.22",
    "@mdx-js/react": "^1.6.22",
    "gatsby": "^4.5.3",
    "gatsby-plugin-google-analytics": "^4.5.0",
    "gatsby-plugin-gravity-forms": "^1.0.4",
    "gatsby-plugin-image": "^2.5.2",
    "gatsby-plugin-manifest": "^4.5.2",
    "gatsby-plugin-mdx": "^3.5.2",
    "gatsby-plugin-react-helmet": "^5.5.0",
    "gatsby-plugin-sharp": "^4.5.2",
    "gatsby-plugin-sitemap": "^5.5.0",
    "gatsby-source-filesystem": "^4.5.2",
    "gatsby-source-wordpress": "^6.5.2",
    "gatsby-transformer-remark": "^5.5.2",
    "gatsby-transformer-sharp": "^4.5.0",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "react-helmet": "^6.1.0"
  }
}

Note: the gatsby-plugin-gravity-forms plugin isn't in the list because build doesn't finish? I can see it's missing. Been trying to get this to work for awhile. New to Gatsby and headless WP.

thanks for any help.

robmarshall commented 2 years ago

Edit: It seems I cannot read.

Could you please drop a copy of your gatsby-config.js file here. I think I may know what the problem is.

justlevine commented 2 years ago

@steelbridge-io what version of WPGraphQL for Gravity Forms are you using? v0.10.0 was a major update that restructured many parts of the schema (e.g. WpGravityFormsForm became WpGfForm) that at first glance dont seem to be compatible with this plugin.

(@robmarshall my react skills arent the best, but I'd love to help with the upgrade however I can. Feel free to reach out on the WPGraphQL slack).

steelbridge-io commented 2 years ago

@justlevine I'm running v1.6.12 WPGraphQL. I can see how the schema is different than what I find in documentation. Maybe downgrade to an earlier release?

steelbridge-io commented 2 years ago

Edit: It seems I cannot read.

Could you please drop a copy of your gatsby-config.js file here. I think I may know what the problem is.

Hi @robmarshall Here's a copy of my Gatsby-config.js process.traceDeprecation = true; module.exports = { siteMetadata: { title:The Trinity Guide - Gatsby Template, description:A Gatsby driven theme for The Trinity Guide., author:Chris Parsons, }, plugins: [ gatsby-plugin-react-helmet, gatsby-plugin-image, { resolve:gatsby-source-wordpress, options: { url:https://headless.thetrinityguide.com/graphql, includedRoutes: [ "**/*/*/categories", "**/*/*/posts", "**/*/*/pages", "**/*/*/media", "**/*/*/tags", "**/*/*/taxonomies", "**/*/*/users", "**/*/*/menus", "**/*/*/menu-locations", ], excludedRoutes: [], // use a custom normalizer which is applied after the built-in ones. normalizer: function({ entities }) { return entities }, }, }, { resolve:gatsby-source-filesystem, options: { name:images, path:${__dirname}/src/images, }, }, gatsby-plugin-sharp, gatsby-transformer-sharp, { resolve:gatsby-plugin-manifest, options: { name:gatsby-starter-default, short_name:starter, start_url:/, background_color:#663399, theme_color:#663399, display:minimal-ui, icon:src/images/ttg-gatsby-icon.png, // This path is relative to the root of the site. }, }, gatsby-plugin-gatsby-cloud // this (optional) plugin enables Progressive Web App + Offline functionality // To learn more, visit: https://gatsby.dev/offline //gatsby-plugin-offline, ], };

robmarshall commented 2 years ago

@steelbridge-io You will also need to include the plugin within Gatsby config. This is what imports the fragments for GraphQl to use. See here for an example of the config: https://github.com/robmarshall/gatsby-plugin-gravity-forms#how-to-use And here for a full step by step with a bit more explaination: https://thoughtsandstuff.com/blog/headless-wordpress-gravity-forms-with-gatsby-step-by-step-tutorial/

steelbridge-io commented 2 years ago

Thanks @robmarshall ... I went and ran everything per your instructions. Even cloned the repo in the tutorial. Same error.

Here's from https://github.com/robmarshall/gatsby-gravity-form-example

`There was an error in your GraphQL query:

Unknown type "WpGravityFormsForm".

GraphQL request:2:33 1 | 2 | fragment GravityFormFields on WpGravityFormsForm { | ^ 3 | formId

File: src/components/form.js:11:33 ` Wonder if it the version of node 16.9.0 ?

Anyway, seems like a really cool plugin. I just can't figure out where I'm failing.

robmarshall commented 2 years ago

@steelbridge-io

Can you confirm that the WordPress plugin WPGraphQL for Gravity Forms is below 0.10.10.

Not WPGrapgQl. The specific plugin WPGraphQL for Gravity Forms