octokit.rb icon indicating copy to clipboard operation
octokit.rb copied to clipboard

RequestError [HttpError]: fetch failed

Open Itxchi808 opened this issue 3 years ago • 1 comments

I wrote this code: const { Octokit } = require("@octokit/rest"); const { Base64 } = require("js-base64"); require("dotenv").config(); const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN, }); const main = async () => { try { const content = "test" const contentEncoded = Base64.encode(content); const { data } = await octokit.repos.createOrUpdateFileContents({ owner: "ItachiAkar", repo: "c", path: "hwid.txt", message: "feat: Added OUTPUT.md programatically", content: contentEncoded, committer: { name: ItachiAkar, email: "", }, author: { name: ItachiAkar, email: "", }, }); console.log(data); } catch (err) { console.error(err); } }; main(); and i got this error: (node:23320) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time (Use node --trace-warnings ... to show where the warning was created) RequestError [HttpError]: fetch failed at D:\hwidbot\node_modules@octokit\rest\node_modules@octokit\request\dist-node\index.js:110:11 at async main (D:\hwidbot\index.js:16:22) { status: 500, request: { method: 'PUT', url: 'https://api.github.com/repos/ItachiAkar/c/contents/hwid.txt', headers: { accept: 'application/vnd.github.v3+json', 'user-agent': 'octokit-rest.js/19.0.3 octokit-core.js/4.0.4 Node.js/18.5.0 (win32; x64)', authorization: 'token [REDACTED]', 'content-type': 'application/json; charset=utf-8' },

Itxchi808 avatar Aug 06 '22 12:08 Itxchi808

Thanks for reaching out, and im Sorry that you're having issues with Octokit.

This is the repo for the Ruby version of Octokit, but you're using JavaScript. Can you post this on octokit/rest.js?

timrogers avatar Aug 06 '22 13:08 timrogers

👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!

github-actions[bot] avatar Jul 26 '23 01:07 github-actions[bot]