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
- ClientException with SocketException: Cl...
hi <@564158268319203348> i have noticed this 500 status code in my function requests, it seems its not able to connect to the internet in the function as reque...
- NEW ERROR Invalid document structure: At...
Error: ```AppwriteException: document_invalid_structure, Invalid document structure: Attribute "pb.kmsgxPkgInfo.id_info" must be an array (400)``` I’m encounter...
- Issues with executor in Appwrite 1.9.0
Hi, I’ve recently did a fresh install of appwrite 1.9.0 self hosted and when I run a function, it just waits indefinite This is the error from the log: [Er...