Figure ref:


Application is using Page router and there are SSR API requests runs on each deploy and after each caching expires cycle

The API requests takes sometimes more than 30 seconds to fetch all the data

Vercel infrastructure Serverless Functions Execution Duration is 15 seconds although the plan is PRO!

So sometimes getting 504 error:


Setting maxDuration of Serverless Functions Execution Duration by:

  • Create vercel.json file in the root folder of the project
  • If you use page router use pages/**/* pattern
  • Add code below to vercel.json file:
  "functions": {
    "pages/**/*": {
      "maxDuration": 300

Now the “Serverless Functions Execution Duration” will be 300 seconds (5 minutes)

Note that:
“Hobby” plan has max 10 seconds,
“Pro” plan has max up to 300 seconds and
“Enterprise” plan can be up to 900 seconds
(these numbers posted in this blog on 12 December 2023, and maybe changed in the future)

Leave a Reply

Your email address will not be published. Required fields are marked *

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.