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.
2
Answers
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.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:The
timeout
, by default takes the value of 30000ms.Additionally, you can change the number of nodes fetched by page(
perPage
).Mixing both customizations:
Play around increasing those default values to see if your requests succeed.