diff --git a/README.md b/README.md
index d96549dcd..45c4b7ce7 100644
--- a/README.md
+++ b/README.md
@@ -302,7 +302,7 @@ const { data: app } = await requestWithAuth(
- options.request.agent
+ options.request.agent (node-fetch only)
|
http(s).Agent instance
diff --git a/src/fetch-wrapper.ts b/src/fetch-wrapper.ts
index 2158fdc3a..fa67c6d09 100644
--- a/src/fetch-wrapper.ts
+++ b/src/fetch-wrapper.ts
@@ -36,6 +36,17 @@ export default function fetchWrapper(
);
}
+ if (
+ typeof globalThis.fetch !== "undefined" &&
+ typeof requestOptions.request?.agent !== "undefined"
+ ) {
+ throw new Error(
+ `Global "fetch" and "agent" options cannot be used together,
+ please use a custom fetch function with the "dispatcher" option,
+ or use "node-fetch" instead. See https://github.com/octokit/octokit.js/discussions/2484`
+ );
+ }
+
return fetch(
requestOptions.url,
Object.assign(
|