Vercel.json API timeout
Answered
Atlantic horse mackerel posted this in #help-forum
Atlantic horse mackerelOP
I'm keep getting this error for some invocations on my api due a timeout
So I wrote this in my vercel.json
Does anyone know how to fix it?
This Serverless Function has timed out.
Your connection is working correctly.
Vercel is working correctly.
504: GATEWAY_TIMEOUT
Code: FUNCTION_INVOCATION_TIMEOUT
ID: cle1::9vjlj-1686611576039-053e9e54f266
So I wrote this in my vercel.json
{
"functions": {
"/pages/api/*.js": { "maxDuration": 60 }
}
}
But I'm getting this error Error: The function path "/pages/api/*.js" is invalid. The path must be relative to your project root and therefore cannot start with a slash.
invalid_function_source: The function path "/pages/api/*.js" is invalid. The path must be relative to your project root and therefore cannot start with a slash.
Does anyone know how to fix it?
18 Replies
if your intention is to increase the default timeout limit, keep in mind this can only be done by changing your account plan
Atlantic horse mackerelOP
I did actually. I have the pro vercel version.
it should be increased automatically, did you upgraded recently?
Atlantic horse mackerelOP
Yeah I did it today.
I would wait a bit, but if it takes too long you can create a post in https://github.com/orgs/vercel/discussions
Atlantic horse mackerelOP
I just put a wallet address with a large amount of borrows.
Thank you bro. Appreciate you answering so fast.
I'll def make an issue
But do you know how to set this up properly
{
"functions": {
"/pages/api/*.js": { "maxDuration": 60 }
}
}
Bec I'm getting an error for it as well in my vercel.json
just make sure this specific operation is not also taking longer than 60s 😅
for the config error you probably want
"pages/api/*.js"
or maybe
"pages/api/**/*.js"
Answer
Atlantic horse mackerelOP
This worked
And it fixed my issue.
Do you work at Vercel?
nope, I just like helping on my free time