
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
- Project receiving 403 Forbidden on /v1/a...
Project ID: 68521bce002aaebde8d0 Endpoint: https://fra.cloud.appwrite.io/v1 Problem: I am receiving a 403 Forbidden error with an empty response body when try...
- Is there a way I run all functions local...
Thanks for the great software! 🙂 One question, the command `appwrite run functions` always requires me to select a function to run without an "All" option. I ...
- SSL Certificate Not Provisioning for Cus...
Hello! I need some help with my Appwrite Cloud project. Project ID: 6878bf3f003760131a6d Custom Domain: api.hustleproof.app Problem: I have correctly configur...
