Hi, when I send a request using js to my function, the request method changes from POST to OPTIONS. It works as POST on postman, or python script, but not when I use js.. anyone seen this before?
TypeScript
fetch(apiUrl, {
method: 'POST',
headers: myHeaders,
body: JSON.stringify(data),
redirect: "follow"
// body: JSON.stringify({
// data: JSON.stringify(data), // Data needs to be a string inside the outer JSON payload
// async: false
// })
})
I tried the 2 approaches above..
TL;DR
When sending a POST request from JS to a function, the request method changes to OPTIONS due to browsers making a preflight CORS check. This behavior is expected. You can adjust your server to handle OPTIONS requests or use a proxy to forward the requests.Are you making this request from a web app? If so, it's expected. Browsers make an OPTIONS call first to check for CORS
Recommended threads
- Functions not executing after usage rese...
Hi team, Last month my project hit 100% usage and functions stopped working (expected). Now the new month has started and usage has reset, requests are going ...
- Functions never end and always fail (sta...
Hi ! I'm using Appwrite Cloud Pro and function execution from appwrite website is KO. Deploying starter function template, execution is always Failed and the ...
- Provider error when creating a function ...