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
- Worker functions stuck on "Fetched 0 fun...
Appwrite Version: 1.9.0 Bug Description: The appwrite-worker-functions container gets stuck in an infinite loop logging "Fetched 0 functions..." while scheduled...
- I am using s3 for app storage but is it ...
_APP_STORAGE_DEVICE=s3 puts everything to the s3 storage but i need to be able to keep the function builds and site in the local and not waste the cloud storage...
- Local Serverless Function Testing: Are D...
I have followed the instructions to get the CLI working, and have been able to log-in, initialize my project, and created a simple Python function, which calls ...