oikeuttaelaimille / gatsby-drupal-webform

React component for Drupal webforms
MIT License
21 stars 9 forks source link

Error Unknown type “webform__webform” using gatsby-drupal-webform & GraphQL #1

Open AlaaHassoun opened 5 years ago

AlaaHassoun commented 5 years ago

I am building a Drupal 8 site fully decoupled using Gatsby (React). The website needs a form. I will use the webform drupal module for this and then get the webform query with graphql to use it with gatsby-drupal-webform plugin

I get this error when using gatsby-drupal-webform in my Gatsby js site :

Failed to compile
GraphQL Error Unknown type "webform__webform". Did you mean "date_format__date_format"?

  file: C:/xampp/htdocs/drupal-gatsby-t/node_modules/gatsby-drupal-webform/dist/Webform.jsx
   1 | 
>  2 |  fragment Webform on webform__webform {
     |                      ^
   3 |      name: drupal_internal__id
   4 |      description
   5 |      status
   6 |      elements {
   7 |          name
   8 |          _type
   9 |          _title
  10 |          _title_display
  11 |          _default_value
  12 |          _description
StevenSymons commented 5 years ago

I'm having the same problem. The problem is caused because webforms store their elements config as one long string. Hope this plugin gets a fix soon to deal with this!

hyrsky commented 5 years ago

Hello,

Sorry for the extremely delayed response! I haven't had time to work on this project until now.

The previous version was just a demo. This code needs a Drupal module to function that I haven't published until now. I just finished rewriting and cleaning up the code and released version 2.0.

I'm going to use the 2.x version on a website I'm building at the moment so I'm planning to support it at least to my needs. I would be happy if someone else finds this useful too!

I still have lots of work to do on documenting how to get this running but the basic steps are: 1) Install the Drupal module (I need to make a better way install it 😁). 2) Give Gatsby user access any webform configuration drupal permission. I recommend installing basic_auth module on Drupal and using basicAuth in gatsby-config.js.

Checking out my CI configuration and examples folder might also be helpful!

And just a warning that I feel I'm not very experienced so I wouldn't use this for a very serious project for now 😀.