plugins icon indicating copy to clipboard operation
plugins copied to clipboard

feat(gatsby-source-strapi): timeout setting for queries

Open george-wb opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe.

Hey guys, the team I'm working with needs a feature that allows us to change the timeout for queries to Strapi. We utilize Strapi as a website builder and have many sites in the CMS. We have a couple of very large sites with over 100 pages, and when the query takes 60 sec or longer we get a 504 timeout error coming from [gatsby-source-strapi]/[axios]/lib/core/createError.js:16:15

Describe the solution you'd like

We'd like to be able to pass in our own timeout parameter for Strapi queries similar to how file fetching has the GATSBY_STALL_TIMEOUT env variable to alter the timeout settings (we've tried this and it doesn't work for our problem).

Describe alternatives you've considered

We have looked through the code to see where the query timeout is being set to 60 seconds and we're not able to find it.

Additional context

Screen Shot 2023-07-28 at 11 13 33 AM

george-wb avatar Jul 28 '23 18:07 george-wb

Sounds like a great feature. A PR would be welcome.

moonmeister avatar Jul 28 '23 18:07 moonmeister

try changing the numbers in strapi config/api.js to get records per page.

maxLimit: 20 means 20 records per page, it should fix the timeout issue hope it helps.

module.exports = {
  rest: {
    defaultLimit: 20,
    maxLimit: 20,
    withCount: true,
  },
}; 

couldn't find how we can set or disable  this in `gatsby-source-plugin` 

yasirhaleem avatar Jul 28 '23 19:07 yasirhaleem