Vercel AI SDK Timing out on server actions...
Answered
kyzo posted this in #help-forum

kyzoOP
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:
Any ideas?
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?

Answered by Ray
the action is on the "/" route right?
add this to
add this to
app/page.tsx
export const maxDuration = 120
11 Replies

@kyzo 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?

the action is on the "/" route right?
add this to
add this to
app/page.tsx
export const maxDuration = 120
Answer

kyzoOP
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
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

kyzoOP
Ah, technically in the page.tsx yeah (in detail, deeper in the components but yeah)

@kyzo Ah, technically in the page.tsx yeah (in detail, deeper in the components but yeah)

yeah so it should be set on it

@kyzo 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

you could try that too, I think both
export const maxDuration
and vercel.json should work
kyzoOP
just tried vercel.json solution - didn't work.
Checking maxDuration now
Checking maxDuration now

kyzoOP
Okay export const
maxDuration
fixed it. Thank you @Ray !!
Np