2 min read
The request for a Serverless Function reached the timeout threshold. This is an application error.
504: Gateway Timeout
Code:
Code:
FUNCTION_INVOCATION_TIMEOUT
If you are seeing an execution timeout error, check the following possible causes:
- The function is taking too long to process a request: Check that any API, or database requests you make in your function, are responding within the Serverless Function Execution Duration limit applicable to your plan.
- Users on Pro and Enterprise plans can configure the maximum duration by using the
maxDuration
property. See the maxDuration section for more information - If you require a longer execution, Edge Functions provide an alternative that only require an initial response within 25 seconds and allow you to continue streaming responses after that time.
- Users on Pro and Enterprise plans can configure the maximum duration by using the
- The function isn't returning a response: The function must return an HTTP response, even if that response is an error. If no response is returned, the function will time out.
- You have an infinite loop within your function: Check that your function is not making an infinite loop at any stage of execution.
- Upstream errors: Check that any external API or database that you are attempting to call doesn't have any errors.
- A common cause for this issue is when the application contains an unhandled exception. Check the application logs, which can be found at the host URL under the
/_logs
path, for example:logs-urlhttps://my-deployment-my-username.vercel.app/_logs
For more information on Serverless Functions timeouts, see What can I do about Vercel Serverless Functions timing out?
Was this helpful?