octokit.rb
octokit.rb copied to clipboard
RequestError [HttpError]: fetch failed
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:
and i got this error:
ItachiAkar,
email: "ItachiAkar,
email: "
(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'
},
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?
👋 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!