【问题标题】:Error Unknown type "webform__webform" using gatsby-drupal-webform & GraphQL错误未知类型“webform__webform”使用 gatsby-drupal-webform & GraphQL
【发布时间】:2020-01-19 03:23:17
【问题描述】:

在我的 Gatsby js 站点中使用 gatsby-drupal-webform 时出现此错误:

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

【问题讨论】:

  • 我编辑了这个问题以提高可读性,但需要更多信息,比如你想要实现什么?你试过什么?
  • 嘿@EricLavault 我正在构建一个使用 Gatsby (React) 完全解耦的 Drupal 8 站点。该网站需要一个表格。我将为此使用 webform drupal 模块,然后使用 graphql 获取 webform 查询以将其与 gatsby-drupal-webform 插件一起使用

标签: javascript reactjs drupal graphql gatsby


【解决方案1】:

我是该模块的作者。这个问题中使用的软件包版本很旧,如果没有我当时未发布的 Drupal hack,它就无法工作。

我建议通过运行npm install gatsby-drupal-webform@latest --save 更新到最新版本

那么你还需要:

  • 从 Drupal 存储库安装 Drupal module。此模块将预处理 Webform jsonapi 输出并打开用于提交表单的 REST 端点。
  • 让 Gatsby 以access any webform configuration 权限访问 Drupal jsonapi。这可以通过为 Drupal 安装 basic_auth 模块和在 gatsby-source-drupal 设置中拥有该权限的用户的 setting username and password 来完成。

你可以看看this example项目。

【讨论】:

    猜你喜欢
    • 2020-06-28
    • 2021-06-20
    • 1970-01-01
    • 2021-05-14
    • 2021-05-08
    • 2018-10-16
    • 2023-03-30
    • 2020-06-01
    • 2019-11-14
    相关资源
    最近更新 更多