简体   繁体   中英

Error Unknown type "webform__webform" using gatsby-drupal-webform & GraphQL

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

I'm the author of the module. The version of the package used in this question is old and it didn't work without my Drupal hacks that were not published at the time.

I would suggest updating to newest version by running npm install gatsby-drupal-webform@latest --save

Then you also need to:

  • Install a Drupal module from the Drupal repository. This module will preprocess Webform jsonapi output and open a REST endpoint that is used to submit forms.
  • Have Gatsby access Drupal jsonapi with access any webform configuration permission. This can be done by installing basic_auth module for Drupal and setting username and password of a user with that permission in gatsby-source-drupal settings.

You can take a look at this example project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM