CORS error on Runtime API endpoint | Community
Skip to main content
Level 2
February 20, 2020
Question

CORS error on Runtime API endpoint

  • February 20, 2020
  • 1 reply
  • 5144 views

I'm setting up an API through OpenWhisk with multiple endpoints:


/privacy/jobs/create POST
/privacy/jobs/{jobID} GET
/privacy/jobs/files/{jobID} GET
/privacy/events/  GET and POST


for my POST /jobs/create endpoint, I am getting CORS errors: 

Access to XMLHttpRequest at 'https://runtime.adobe.io/apis/****/privacy/jobs/create' from origin 'https://requestdomain.com' 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.


I can access the endpoint with Postman just fine. To test if it was just a nested endpoint issue, I created a GET /jobs/create endpoint (same endpoint, different method), and am receiving 0 errors accessing directly from the browser. The only difference is that my POST /jobs/create endpoint points to a zip action. My GET /jobs/create does not.

Is there something I'm missing in my zip action? 

I've added access-control headers to my return: 

 

return { headers: { 'Access-Control-Allow-Origin':'*', 'Content-Type':'application/json' }, statusCode: 200, body: { jobIds: privacy_jobIds } };


What am I doing wrong here? I can access every other endpoint on the /privacy API just fine.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

Adobe Employee
April 14, 2020