fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). #168

Open
opened 2024-03-28 11:34:23 +00:00 by earl-warren · 0 comments
Owner

https://github.com/octokit/octokit.js/#fetch-missing

Fetch missing

If you get the following error:

fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}).

It probably means you are trying to run Octokit with an unsupported version of NodeJS. Octokit requires Node 18 or higher, which includes a native fetch API.

To bypass this problem you can provide your own fetch implementation (or a built-in version like node-fetch) like this:

import fetch from "node-fetch"; const octokit = new Octokit({ request: { fetch: fetch, }, });

https://github.com/octokit/octokit.js/#fetch-missing > #### Fetch missing > > If you get the following error: > > > fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). > > It probably means you are trying to run Octokit with an unsupported version of NodeJS. Octokit requires Node 18 or higher, [which includes a native fetch API](https://nodejs.org/en/blog/announcements/v18-release-announce#fetch-(experimental)). > > To bypass this problem you can provide your own `fetch` implementation (or a built-in version like `node-fetch`) like this: > > import fetch from "node-fetch"; const octokit = new Octokit({ request: { fetch: fetch, }, });
earl-warren added the
Kind/Bug
label 2024-03-28 11:34:23 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: forgejo/runner#168
No description provided.