Next.js Discord

Discord Forum

Trouble changing default serverless execution duration on Vercel using vercel.json

Answered
Grass carp posted this in #help-forum
Open in Discord
Grass carpOP
I have a Pro account on Vercel which should allow me to run 300 seconds long serverless functions. I tried to change the vercel.json file to contain the folllowing:

{
  "functions": {
    "pages/api/**/*": {
      "maxDuration": 300
    }
  }
}


... to see if anything would change in vercel, but it still says 15 seconds.

I am using pages to create my API, and the structure is like:
/
vercel.json
- /pages
  - /api
    - /general
      - feedback.ts
      - fetchJob.ts
        ...
Answered by Grass carp
Turns out that I need to put

export const config = {
    maxDuration: 300
};


in my function files directly instead of using vercel.json
View full answer

1 Reply

Grass carpOP
Turns out that I need to put

export const config = {
    maxDuration: 300
};


in my function files directly instead of using vercel.json
Answer