Hello,
I have created a function that I want to run in the background.
I am using Postman to invoke a function.
Before the last Appwrite update, I was using a key "async" with a value set to true in the JSON body
Previous JSON:
{
"data": {/*Custom data*/}
"async": true
}
But now I don't know how and where to set the async to true.
Can someone please help me?
Thanks.
the api has changed See https://appwrite.io/docs/references/cloud/client-rest/functions#createExecution
Hi Steven,
Thanks for your response.
Yes, I have checked it already. However in Postman or when sending HTTPS fetch request using js, how can I set async?
Example code:
const url = "<Appwrite EndPoint>";
const data = {
key1: 'value1',
key2: 'value2'
}
const options = {
method: 'POST',
headers: {/* Required headers */ },
body: JSON.stringify(data),
};
const res = await fetch(url, options);
In the code above, where to add the async option? (in header, body??)
don't you see the example HTTP request in the docs i linked?
I can see it and Its not working 😦
What are you doing?
I tried to send data like this
{
"authKey":"<WP AuthKey>",
"url":"<WP URL>",
"type":"<WP Type>",
"status":"<WP Status>",
"category":"<WP Category>",
"tag":"<WP Tag>"
}
and This
{
"body": {
"authKey":"<WP AuthKey>",
"url":"<WP URL>",
"type":"<WP Type>",
"status":"<WP Status>",
"category":"<WP Category>",
"tag":"<WP Tag>"
},
"async": false,
"path": "[PATH]",
"method": "GET",
"headers": {}
}
Its working perfectly but both time its not running in the background...
the second one is correct....and you need to set async
to true
to make it execute in the background
I tried, still do not running in background
What's your code exactly? What is going on?
Btw, body still needs to be a string.
Hi Steven,
I tried to run the function again with a URL like this: "https://cloud.appwrite.io/v1/functions/[Function ID]/executions/" and it's working perfectly.
However when making a request using a generated domain by appwrite, the async feature isn't working.
Why? Do generated domains not support async???
Yes correct, that's expected.
Ok. Thanks for the help 🙂
Recommended threads
- How to Avoid Double Requests in function...
I'm currently using Appwrite's `functions.createExecution` in my project. I want to avoid double requests when multiple actions (like searching or pagination) a...
- Project in AppWrite Cloud doesn't allow ...
I have a collection where the data can't be opened. When I check the functions, there are three instances of a function still running that can't be deleted. The...
- Get team fail in appwrite function
I try to get team of a user inside appwrite function, but i get this error: `AppwriteException: User (role: guests) missing scope (teams.read)` If i try on cl...