Back

CORS error in the middle of function execution

  • 0
  • Functions
  • Web
Phoinex
29 Sep, 2023, 20:34

I am trying to invoke a function from the client and initially the request is received the and the function begins execution, however after about 20 seconds I get CORS error :

TypeScript
 Access to XMLHttpRequest at 'https://server/v1/functions/650a084ca71f8e6092d9/executions' from origin 'https://client' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

so far I have checked that the function id is correct, the domain is set in the platforms tab and I also included the header 'Access-Control-Allow-Origin': '*' but none worked. I tested requesting the function from localhost and from a deployed site but they both return the same error. I also included a screenshot of chromes network tab

TL;DR
The user is experiencing a CORS error while executing a function. They have set the function's permission to "any" and have not manually included the project id. They are unsure if the header being referred to is "X-Appwrite-Project" and they want to know if the project id should be in the request header. They are also wondering about the permissions on the function. The user is trying to invoke the function from the client and initially the request is received and the function starts executing, but after about 20 seconds, they receive a CORS error stating that there is no 'Access-Control-Allow-Origin' header present on the requested
Drake
30 Sep, 2023, 01:21

Is the project id in the request header? What are the permissions on the function?

Phoinex
30 Sep, 2023, 10:03

The funtction permission is set to any , and no I didn't include the project id manually, is this the header you are referring to X-Appwrite-Project ?

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more