-
Notifications
You must be signed in to change notification settings - Fork 56
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]: octokit.repo.getReleaseAsset download binary content failing #772
Comments
👋 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 labeled with |
A 405 error is supposed to indicate that the method ( Octokit doesn't do streams by default, it will try to resolve to text. The docs are misleading in that sense because they are generic and don't necessarily apply to Octokit. We simply take GitHub's OpenAPI spec and use it to write the documentation using the provided annotations and descriptions for each route of the API. This endpoint is supposed to redirect you to the download location for the release asset. In order to use streams in NodeJS instead of parsing the body, set the import { Octokit } from "@octokit/rest";
const octokit = new Octokit();
octokit.rest.repos.getReleaseAsset({
owner,
repo,
asset_id: resultsAsset.id,
headers: {
accept: "application/octet-stream",
},
request: {
parseSuccessResponseBody: false
}
}) Octokit is not impervious to CORS issues on GitHub's end. There isn't anything we can do, it has to be fixed by GitHub. |
Thanks for the response! Tested with the following but still seeing the same error in the browser.
Will look for other workarounds. |
I'll also see if I can find a GitHub issue or discussion to report octokit as impacted. the non-download binary works, but not the binary download
(this returns metadata about asset as expected) |
What happened?
When using as documented, observed content blocked errors instead of expected return.
The expectation is that the contents of the asset would be streamed if we use Octokit to hit this api endpoint where GitHub traditionally blocks CORS.
I am using octokit in .tsx files and attempting to get the contents of a json file from the release asset specific as a particular id.
Versions
octokit/rest v21.0.2, Node v20.16.0
Relevant log output
Code of Conduct
The text was updated successfully, but these errors were encountered: