graphql 无法将 100 多种产品添加到我的 Wordpress Woocommerce 商店

Posted

技术标签:

【中文标题】graphql 无法将 100 多种产品添加到我的 Wordpress Woocommerce 商店【英文标题】:graphql fails at adiing 100+ products to my Wordpress Woocomerce store 【发布时间】:2021-11-15 07:17:30 【问题描述】:

有人知道如何解决这个 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

【问题讨论】:

【参考方案1】:

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


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

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

如果您使用GATSBY_CONCURRENT_REQUEST 环境变量,请注意以下声明:

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

【讨论】:

以上是关于graphql 无法将 100 多种产品添加到我的 Wordpress Woocommerce 商店的主要内容,如果未能解决你的问题,请参考以下文章

如何将共享到 GraphQL Bin 选项添加到我的 Apollo 服务器游乐场?

GraphQL - 将 ObjectType 传递给参数

如何在graphql中将装饰器添加到args参数

无法在 jest vue 中导入 graphql 查询文件

无法使用 GraphQL 和 Apollo 将文件上传到 Strapi

如何让 Redux Thunk 和 Apollo GraphQL 协同工作