首页 > 解决方案 > graphql 无法将 100 多种产品添加到我的 Wordpress Woocomerce 商店

问题描述

任何人都知道如何解决这个graphql错误?我不能向我的商店添加超过 50 件商品。
我在选项架构中提出了超时options: {schema: { timeout: 1000000,},}
并将这一行添加到 wp.config 文件中define( ‘WP_MEMORY_LIMIT’, ‘512M’ );
,但它没有解决问题。我的最大值是 46 项,但我想这不是限制。

info  gatsby-source-wordpress  GraphQL vars: {"first":70,"url":"http://my-web-url/graphql","after":null}
error  gatsby-source-wordpress  Your wordpress server at http://my-web-url/graphql appears to be overloaded.
Try reducing the requestConcurrency for content updates or the previewRequestConcurrency for previews:
{
  resolve: 'gatsby-source-wordpress-experimental',
  options: {
    schema: {
      requestConcurrency: 5, // currently set to undefined
      previewRequestConcurrency: 2, // currently set to undefined
    }
  },
}
The GATSBY_CONCURRENT_REQUEST environment variable is no longer used to control concurrency.
If you were previously using that, you'll need to use the settings above instead.
not finished source and transform nodes - 5.466s
not finished  gatsby-source-wordpress  fetching nodes - 5.390s - 15 total
not finished  gatsby-source-wordpress  PaColor - 3.871s
not finished Downloading remote files - 3.569s
not finished Generating image thumbnails - 3.428s
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed.
Exit code: 1
Command: /node14/bin/node
Arguments: /vercel/.yarn/lib/cli.js build
Directory: /vercel/path0/site
Output:
info Visit https://yarnpkg.com/en/docs/cli/workspace for documentation about this command.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! gatsby-woocommerce-themes@2.0.1 build: `yarn workspace site build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the gatsby-woocommerce-themes@2.0.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /vercel/.npm/_logs/2021-09-21T17_39_01_248Z-debug.log
Error: Command "npm run build" exited with 1

标签: reactjswordpresswoocommercegraphqlgatsby

解决方案


嗯,这很简单。您已经达到了超时/过载响应,这不仅是因为页面数量,还因为它的内容和重量。使用提供的解决方案:

{
  resolve: 'gatsby-source-wordpress',
  options: {
    schema: {
      requestConcurrency: 50, 
      previewRequestConcurrency: 50, 
    }
  },
}

并按照文档的建议使用requestConcurrencypreviewRequestConcurrency价值观。使用之前的值 (50) 应该可以工作,因为现在设置为undefined这样,您应该会看到一些改进。

GATSBY_CONCURRENT_REQUEST请注意以下语句,如果您使用环境变量,这也很重要:

GATSBY_CONCURRENT_REQUEST环境变量不再用于控制并发。如果您以前使用过它,则需要改用上面的设置。


推荐阅读