Next.js Discord

Discord Forum

Vercel AI SDK Timing out on server actions...

Answered
kyzo posted this in #help-forum
Open in Discord
Avatar
Hi everyone, I'm building an AI agent using Vercel's AI SDK and I'm struggling so much with the execution...

Whenever my Agent decides to do a longer call, the whole function times out at 15 seconds.
I'm on the Pro plan so it should be possible to adjust it, but I just don't know what I can actually do in this case.
My vercel.json looks like this:
{
  "functions": {
    "app/api/**/*.ts": {
      "maxDuration": 120
    },
    "app/*.ts": {
      "maxDuration": 120
    },
    "app/**/*.ts": {
      "maxDuration": 120
    }
  }
}


Any ideas?
Image
Answered by Ray
the action is on the "/" route right?
add this to app/page.tsx
export const maxDuration = 120
View full answer

11 Replies

Answer
Avatar
no it's in actions.tsx file.
Its not possible to specify the maxDuration in the action.tsx file, right?

I just realised I added *.ts to vercel.json and not .tsx, maybe that will help
the action will make a request to the current route
so set the maxDuration on that route should do it
Avatar
Ah, technically in the page.tsx yeah (in detail, deeper in the components but yeah)
Avatar
just tried vercel.json solution - didn't work.

Checking maxDuration now
Avatar
Okay export const maxDuration fixed it. Thank you @Ray !!
Avatar
Np