'After adding more products to woocomerce wordpress store graphql fails

anyone knows how to fix this graphql error? It appeared after i've added more woocomerce products. Url seems to be good because after deleting part of the woocomerce prducts everything stars to work like normal again.

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.


Solution 1:[1]

To fix this issue you need to raise the timeout in your gatsby-config.js file by adding options schema. options: {schema: { timeout: 1000000,},}

But solely doing this will probably not be enough as if you are getting timeout error your wordpress server is either already overloaded or will be shortly. You need to raise allocated memory in your wordpress server. You can do that by using some FTP software like filezilla and adding this line to wp.config file. define( ‘WP_MEMORY_LIMIT’, ‘512M’ ); If you don't have as much data you should chose lower number like 256MB.

Solution 2:[2]

The output is quite self-explanatory. You've reached the timeout threshold because of the addition of more data to fetch.

As it has been prompted, you can add a bunch of options to gatsby-sourde-wordpress to customize that limit:

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

The timeout, by default takes the value of 30000ms.

Additionally, you can change the number of nodes fetched by page(perPage).

Mixing both customizations:

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

Play around increasing those default values to see if your requests succeed.

Solution 3:[3]

In your gaysby-config.js , add these options could fix the issue.

options: {
    url: `${wordPressUrl}/graphql`,
    verbose: true,
    schema: {
      timeout: 1000000,
      perPage: 10,
      requestConcurrency: 50,
      previewRequestConcurrency: 50,
    },
    develop: {....

You can check for more options here : Timeout error gatsby development

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tomas Sinkevi?ius
Solution 2 Ferran Buireu
Solution 3 R. Moshiur