[BUG]: HttpError: Failed to fetch (CORS policy) #397
Labels
Status: Up for grabs
Issues that are ready to be worked on by anyone
Type: Bug
Something isn't working as documented
Type: Support
Any questions, information, or general needs around the SDK or GitHub APIs
What happened?
We are seeing sporadic POST requests using octokit/rest.js failing. The requests come back with the error
HttpError: Failed to fetch
andAccess to fetch at 'https://api.github.com/repos/ChapmanAutoGroup/sites.retail/git/trees' from origin [our site] has been blocked by CORS policy: 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.
We're calling the
git.createTree
andgit.createBlob
methods. We have seen it fail on either one at different times.We've also noticed that attempting the same exact request using the same headers and payload will eventually result in a success, although the number of retries can vary from 1 to over a dozen.
The library is being using in a Vue app. We've seen the error running both locally and on a production server.
Any ideas what is causing the CORS issue?
Versions
node: 18.17.1
@octokit/rest: 20.0.2
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: