
@huylv What's the SDK you're using?

I used "node-appwrite": "^9.0.0" to write cloud functions

Then you should list executions this way:
const promise = functions.listExecutions('[FUNCTION_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

my implementation:
const executions = await Appwrite.functions.listExecutions(createOrderFunctionId, [
Query.equal("status", "waiting"),
Query.equal("status", "processing"),
])
they are the same @D5

what wrong with my query?

Check if there is any log in the container: appwrite-worker-functions

I found this log about this function

what about docker compose logs appwrite
?

error no configuration file provided: not found

can you show the complete log?

there is no log, docker compose logs appwrite
show that error


If there is no solution, it's hard to use appwrite on production 😦

Did you have set in your appwrite instance an API key?

I will also need to do a similar implementation

You essentially need to create a lock. You can do this by creating a locks collection. When a user executes the create order function, it'll create a document in the locks collection with ID of the user. If the document is created successfully, it'll continue to process the order. Before the function finishes, it must delete the document to release the lock.

Seems like the other functions will get executed before the document has been created.

What do you mean?

The user is checking if an element already exists in database, I think that should not be different from creating a lock collection. The problem is that the first function creates the element so other run simultaneously will not "see" the firstly created document.

I wasn't suggesting to check for a document. The first execution will create the document. If another execution tries to run at the same time, the create document will fail so the function will exit

@huylv Then try this

I will try too next week

I tried and it worked as expected. Thanks Steven and D5, but is this a formal way to achieve this. I though Database transaction
is the solution for almost project

feel free to 👍🏼 this issue for transactions: https://github.com/appwrite/appwrite/issues/2788

[SOLVED] Prevent cheater from spam execute function
Recommended threads
- Error
I'm trying to get sellerId using account.get() in my appwrite function and this is the error message I'm getting: "Failed to send notification to seller 6865bf...
- Is there a timeframe for updating dart r...
Dart 3.5 is already one year old, and the following versions have introduced very important features for the language. Is there a roadmap or timeframe for when...
- Error
I'm trying to get sellerId using account.get() in my appwrite function and this is the error message I'm getting: "Failed to send notification to seller 6865bf...
