@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
- Need help with createExecution function
Hi, Need some help understanding createExecution. When requesting function execution via createExecution, the function handler arguments are incorrect and rese...
- HTTP POST to function returning "No Appw...
Hi everyone, I’m running into an issue with my self-hosted Appwrite instance. I’ve set up my environment variables (APPWRITE_FUNCTION_PROJECT_ID, APPWRITE_FUNC...
- Can't add dart 3.5 runtime
Modified the `.env` to enable dart 3.5 runtime on my self-hosted instance but still can't find the runtime when creating a new function. I manually pulled the i...