Back

Functions timeout after 30 seconds, not according to function timeout settings

  • 0
  • Functions
  • Cloud
Sonicviz
12 Jul, 2024, 00:05

The timeout section on cloud functions says " Timeout Limit the execution time of your function. Maximum value is 900 seconds (15 minutes)." but in practice there seems to be a hard limit of 30 seconds from this error message: "Synchronous function execution timed out. Use asynchronous execution instead, or ensure the execution duration doesn't exceed 30 seconds.\nError Code: 408"

I'm definitely using an asynch await call in this function as well, it's not synchronous.

Could someone from AW please confirm (would like an official position statement, thanks) what the timeout limit actually is, and if it will conform with the current stated description, and if so, when? ty! Or if it is as stated do you have some example code to clarify what the error message means. Example use case here is a long await call to an LLM that needs some thinking time to return output.

TL;DR
Developers are facing timeout errors after 30 seconds despite specifying longer duration. The issue arises due to synchronous executions when the async parameter is false. To solve this, developers should set async to true and execute the function asynchronously. The timeout should actually be 15 minutes, but in practice, it's limited to 30 seconds. The support team needs to provide clarification on the actual timeout limit and update the documentation accordingly.
Steven
12 Jul, 2024, 00:11

synchronous executions have a hard timeout of 30 seconds. Synchronous executions are executions where the `async` param is false or functions executed via function domain

Sonicviz
12 Jul, 2024, 00:27

Thanks. Can you make that a little clearer? I'm calling LLM's, and the larger models can easily take more than 30 seconds for some grounded research tasks. I'm basing my code on the AW example templates, and an example function code call would be

TypeScript
    try {
      const response = await client.messages.create({

Isn't asynch implied by an await? Why should a function interpret this differently from "normal" asynch await?

How do I implement what you suggest then? Code example? Thanks.

Sonicviz
12 Jul, 2024, 00:28

Or is it not going to be possible to do this?

Steven
12 Jul, 2024, 00:41

no the inside of the code has nothing to do with it.

Synchronous executions are executions where the `async` param is false or functions executed via function domain

Steven
12 Jul, 2024, 00:43

I would suggest:

  1. executing your function asynchronously (async param == true)
  2. write to a document
  3. use realtime or poll for updates on that document
Sonicviz
12 Jul, 2024, 00:52

Ah. my bad. I see it now in the docs @ async boolean Execute code in the background. Default value is false. https://appwrite.io/docs/references/cloud/client-web/functions#createExecution

Will do, thanks. You can close this one.

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