Reference

FUNCTION_INVOCATION_TIMEOUT

The request for a Serverless Function reached the timeout threshold. This is an application error.
Table of Contents

The FUNCTION_INVOCATION_TIMEOUT error occurs when a function invocation takes longer than the allowed execution time. This could be due to an error within the function itself, a slow network call, or an issue with the environment in which the function is running.

504

FUNCTION_INVOCATION_TIMEOUT

Gateway Timeout

To troubleshoot this error, follow these steps:

  1. 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 maximum duration limit applicable to your plan
  2. 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
  3. You have an infinite loop within your function: Check that your function is not making an infinite loop at any stage of execution
  4. Upstream errors: Check that any external API or database that you are attempting to call doesn't have any errors
  5. 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-url
https://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?

Last updated on July 24, 2024