Next.js Discord

Discord Forum

How can i set maxDuration of Serverless Functions of Pro plan?

Answered
Silken Windhound posted this in #help-forum
Open in Discord
Silken WindhoundOP
Hello guys,

How can i set maxDuration of Serverless Functions of Pro plan?
it shows Execution Duration / Limit 15s in logs! Shouldn't it be 300 seconds?
Answered by Ray
vercel.json
{
  "functions": {
    "pages/**/*": {
      "maxDuration": 300 // This function can run for a maximum of 300 seconds
    }
  }
}
View full answer

11 Replies

Silken WindhoundOP
@Ray yes i put it in _app.tsx but still the limit is 15 seconds and i'm on PRO plan
oh you using page router?
Silken WindhoundOP
yes
vercel.json
{
  "functions": {
    "pages/**/*": {
      "maxDuration": 300 // This function can run for a maximum of 300 seconds
    }
  }
}
Answer
if you use src folder, then the key should be "src/pages/**/*"
Silken WindhoundOP
Great, it works, when i tried use vercel.json file i was set pattern wrong, pages/**/* fixed it

Thank you @Ray 🙏🏻
cool, please mark solution if your issue has been solved
Silken WindhoundOP
Code below in vercel.json file in root folder solved my problem.

{
  "functions": {
    "pages/**/*": {
      "maxDuration": 300
    }
  }
}
you could right click the answer > application > mark solution 👍🏾
Silken WindhoundOP
Done!