Back

Cloud Functions timeout, even though I've set the timeout settings to 900.

  • 0
  • Functions
  • REST API
  • Cloud
Ahmed Ibrahim
20 Dec, 2023, 09:18

Hi,

I have a cloud function in the Appwrite cloud project. I noticed that my users receive an error response when their requests exceed 30 seconds.

However, I created a dummy cloud function to investigate with simple code that waits 40 seconds and returns dummy text. It returns an error after 30 seconds, even though I've set the timeout value to 900 seconds.

The dummy function:

TypeScript
Future<dynamic> main(final context) async {
  await Future.delayed(Duration(seconds: 40));
  return context.res.send('Hello, World!');
}

The error that I received in response:

TypeScript
Error 400
Internal error: Operation timed out after 30001 milliseconds with 0 bytes received

Type
general_argument_invalid

I'm calling the function using a RESTful API, and I'm using the cloud version of Appwrite. Also, I've set the timeout to 900 in the function's settings.

TL;DR
The user is experiencing a timeout issue with their cloud function in Appwrite. They have set the timeout value to 900 seconds but are still receiving an error after 30 seconds. The user has confirmed the timeout setting is updated in the function's settings. They have also tried executing the function asynchronously. The error message suggests an internal error with a timeout after 30 seconds. Solution: The user should ensure that they have updated the timeout value not only in the function's settings but also in the appwrite.json file when deploying the function. If the appwrite.json file is not updated, it will set the timeout value back to the
Kenny
20 Dec, 2023, 14:17

Just to verify, in Functions -> function -> settings -> timeout it says 900? I manually deploy most my functions and if you haven't updated the appwrite.json file when deploying it sets the timeout value back to the default.

Drake
20 Dec, 2023, 14:49

Synchronous executions have a hard timeout of 30s

Ahmed Ibrahim
20 Dec, 2023, 14:52

Are there any solutions to ensure that the function completes its execution within the timeout period?

Ahmed Ibrahim
20 Dec, 2023, 14:54

Yes, I'm updating the timeout to 900 in the function settings whenever I make a new deployment

Drake
20 Dec, 2023, 16:21

for slower functions, you should be executing them asynchronously

Drake
20 Dec, 2023, 20:04

@VincentGe have we documented this yet?

VincentGe
20 Dec, 2023, 20:09

Is this cloud specific? First time hearing about this

Drake
20 Dec, 2023, 20:17

nope, not cloud specific

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more