首页 > 解决方案 > 向 woocomerce wordpress 商店添加更多产品后,graphql 失败

问题描述

有谁知道如何解决这个graphql错误?它出现在我添加了更多 woocomerce 产品之后。网址似乎很好,因为在删除了部分 woocomerce 产品后,一切都恢复正常工作了。

ERROR 

timeout of 30000ms exceeded


 ERROR #gatsby-source-wordpress_111006 

 gatsby-source-wordpress  It took too long for https://my-web-url/graphql to respond (longer than 30 seconds).

Either your URL is wrong, you need to increase server resources, or you need to decrease the amount of resources each
request takes.

You can configure how much resources each request takes by lowering your `options.schema.perPage` value from the default
of 100 nodes per request.
Alternatively you can increase the request timeout by setting a value in milliseconds to `options.schema.timeout`, the
current setting is 30000.

GraphQL request to https://my-web-url/graphql failed.

标签: reactjswordpressgraphqlgatsby

解决方案


输出是不言自明的。由于添加了更多要获取的数据,您已达到超时阈值。

正如提示的那样,您可以添加一系列选项来自gatsby-sourde-wordpress定义该限制:

{
  resolve: `gatsby-source-wordpress`,
  options: {
    schema: {
      timeout: 30000,
    },
  },
}

,timeout默认情况下采用 30000ms 的值。

perPage此外,您可以更改 page( )获取的节点数。

混合两种自定义:

{
  resolve: `gatsby-source-wordpress`,
  options: {
    schema: {
      timeout: 30000,
      perPage: 100,
    },
  },
}

尝试增加这些默认值以查看您的请求是否成功。


推荐阅读