mattburnett-repo/pv-estimate

Intermittent CORS error

Closed this issue · 1 comments

Sometime the following happens, sometimes not:

"Access to XMLHttpRequest at [API Gateway ARN] from origin [React App URL] has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource."

It looks like everything is configured correctly. Of course that could be mistaken, and instead there is some small detail that goes unnoticed. However, it doesn't make sense that this error appears intermittently. It should either work or fail, with no "in-between".

[several paragraphs of diagnostic process deleted]

It looks like the Lambda timeout (3sec) was the issue. The third-party API takes sometimes more than three seconds to return (avg. 4sec). Increased the timeout in the pv-estimate_getEstimate Lambda (console -> configuration -> general configuration -> timeout) to 5sec.