
Hi there,
I have a dart-2.17 function timing out after 30 sec for a single databases.listDocuments
call. When I run the same code locally in my test it works just fine, but in the function execution it times out.
Code looks like this:
final existingGCOs = await database.listDocuments(
databaseId: 'sample_databaseId',
collectionId: 'sample_collectionId',
queries: [
Query.equal('sample_attribute', attribute),
Query.limit(500),
],
);
When I put a return context.res.json({'End': 'End'});
before the listDocuments
call, it works fine but when I put it behind the listDocuments
it times out.
Any ideas what might go wrong? I've already checked all the database id/collection id/project id/endpoint/API key/self signed values and they all seem to fit since my local test is using them as well and works fine.
Running self-hosted appwrite version 1.4.9

Would you please try increasing the timeout? Maybe you'll see the root cause

The timeout is maxed out at 900s but it still times out after 30s (as per error log)

This is the error message from the console Execution timed out.

We ran some more tests to figure out the problem and did the following both on local self hosted and on a droplet. The function basically reads some data as described above and afterwards should create 50 (our test case) documents. We wrote a test which calls createExecution
and put an array of 50 11 character strings as json data into the function. This execution is done 5 times with different data each execution. These tests time out every time now. We delete all the data in the collection after each test to clean the database again. On the other hand, when we put the exact same data from the test into the appwrite console and execute the function it runs fine in under 1s.
Because we are desperate, we moved up the return statement to narrow down what causes the function to time out. We ended up with the above listDocuments
call which seemed to execute. Again we have reproduced this behavior on two self hosted (locally and do droplet) appwrite instances both running v1.4.13.

Does listDocuments
has a timeout?

Did you execute it from the Appwrite console?

On the other hand, when we put the exact same data from the test into the appwrite console and execute the function it runs fine in under 1s.
How is this test different? is it not creating hte documents in the function because it's already created?

It may for queries that take too long.

Thats the point. The test is not different. We ran the tests and the console execution on the same empty database.

Since the query only contains one equal
with one attribute and an limit(500)
on an collection that only contains 1 document at the time of execution. So is there a timeout after 30s for listDocuments()
?

Yes, as said before from console it runs fine but not from createExecution()

how long does it take to execute when running from console?

yes, synchronous executions have a hard timeout of 30s

on an empty database works fine?

Executed from console it takes under 1s

No, all our tests run on an empty database. The only difference is the execution from console or from the createExecution()
method from the dart sdk. From Console the function works fine and executes in under 1s, but from createExecution()
it times out after 30s

Do you have other functions that work when executed using create execution?

Yes, pretty much all the other functions (approx. 15) are working fine
Recommended threads
- Function issue.
We're facing a critical issue with our Appwrite Function where the Python runtime (context.req.body) consistently receives an empty request body for POST reques...
- Deploy to Cloud Error
I'm trying to migrate my localhost instance to appwrite cloud. After I click on "Deploy to cloud" it takes me to my cloud instance for "Cloud migration", but w...
- smtp data not accepted
I have a Problem with the smtp.. it says data not accepted.. i invited a user to my Project so what is that ``` _APP_SMTP_HOST=smtp.mailersend.net _APP_SMTP_PO...
