Hello am trying to send a post request to my appwrite functions api server but am getting this error:
Access to fetch at 'https://[url_id].appwrite.global/' from origin 'http://localhost:3005/' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Your function will need to send back the header to allow your client.
and how can i send back the header to the client if am using the appwrite Starter function template
because am trying to set the header like this:
res.setHeader('Access-Control-Allow-Origin', '*');
and am getting this error: TypeError: res.setHeader is not a function
It would be a parameter to the function: https://github.com/open-runtimes/open-runtimes/blob/a3f20033b642d75096bc9754301e6d1525cebd1e/runtimes/node-20.0/src/server.js#L79
Recommended threads
- SSL certificate issuance failed:
Domain verifies but SSL cert fails, tried different subdomains like .api and .aw, used cname and CAA, no prior CAA existed on website, tried Multiple CAAs at on...
- Password check in function
Hi, is there any way now for checking if the users password is correct in a function? I am creating a delete user function and before deleting I would like to c...
- Deployment fails after 15+ minutes: "Wai...
Hi, I'm Jayden. My email is jaydthom@haverford.org, and i'm having persistent deployment failures with my Next.js project. What happens: Push to GitHub trigg...