Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: HttpError: Failed to fetch (CORS policy) #397

Open
1 task done
mchestnut opened this issue Jan 11, 2024 · 2 comments
Open
1 task done

[BUG]: HttpError: Failed to fetch (CORS policy) #397

mchestnut opened this issue Jan 11, 2024 · 2 comments
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

Comments

@mchestnut
Copy link

What happened?

We are seeing sporadic POST requests using octokit/rest.js failing. The requests come back with the error HttpError: Failed to fetch and Access 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 and git.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

  • I agree to follow this project's Code of Conduct
@mchestnut mchestnut added Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented labels Jan 11, 2024
Copy link
Contributor

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

@kfcampbell kfcampbell added Status: Up for grabs Issues that are ready to be worked on by anyone Type: Support Any questions, information, or general needs around the SDK or GitHub APIs and removed Status: Triage This is being looked at and prioritized labels Jan 18, 2024
@wolfy1339
Copy link
Member

This seems more like a GitHub infrastructure issue than an issue with Octokit itself

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
Status: 🔥 Backlog
Development

No branches or pull requests

3 participants