Checklist
Describe the problem you'd like to have solved
Hi, I'm just wondering if there is a way to add back support for providing a custom fetch implementation in node-auth0 v5 (for example via ManagementClientOptions), so that consumers can control the HTTP transport used by the SDK.
Overview
In PR [#1238](#1238), the generated client and fetcher layer were updated to support a fetchFn override internally:
BaseClientOptions now has an optional fetch?: typeof fetch.
- Resource clients pass this through as
fetchFn: this._options?.fetch.
fetcherImpl uses args.fetchFn ?? (await getFetchFn()), so a custom fetch can be injected at the core layer.
However, the public wrapper still explicitly prevents this from being used by library consumers:
// ManagementClientOptions omits "fetch" from FernClient.Options:
export interface ManagementClientOptions
extends Omit<FernClient.Options, "token" | "environment" | "fetcher" | "baseUrl" | "fetch"> {
// ...
}
The ManagementClient constructor also deletes any fetch property:
// Temporarily remove fetcher from options to avoid people passing it for now
delete (_options as any).fetcher;
delete (_options as any).fetch;
So today, although the underlying transport already supports fetchFn, there is no supported public way for users to provide their own fetch.
There is [a PR](#1324) that aims to address a similar concern around retry behavior, but it seems like it would be much simpler if the SDK just exposed the fetch option so people can plug in their own implementation (including any custom retry logic) directly.
Describe the ideal solution
Officially support a fetch option on the public clients for v5
import { ManagementClient } from "auth0";
import { makeFetchWithRetry } from 'path/to/custom-retry-logic.js';
const management = new ManagementClient({
domain: "your-tenant.auth0.com",
clientId: "…",
clientSecret: "…",
// New: let consumers supply a custom fetch implementation
fetch: makeFetchWithRetry,
});
Or if can, is there any official guidance / support for handling such scenarios?
Alternatives and current workarounds
No response
Additional context
No response
Checklist
Describe the problem you'd like to have solved
Hi, I'm just wondering if there is a way to add back support for providing a custom
fetchimplementation innode-auth0v5 (for example viaManagementClientOptions), so that consumers can control the HTTP transport used by the SDK.Overview
In PR [#1238](#1238), the generated client and fetcher layer were updated to support a
fetchFnoverride internally:BaseClientOptionsnow has an optionalfetch?: typeof fetch.fetchFn: this._options?.fetch.fetcherImplusesargs.fetchFn ?? (await getFetchFn()), so a custom fetch can be injected at the core layer.However, the public wrapper still explicitly prevents this from being used by library consumers:
The
ManagementClientconstructor also deletes anyfetchproperty:So today, although the underlying transport already supports
fetchFn, there is no supported public way for users to provide their ownfetch.There is [a PR](#1324) that aims to address a similar concern around retry behavior, but it seems like it would be much simpler if the SDK just exposed the
fetchoption so people can plug in their own implementation (including any custom retry logic) directly.Describe the ideal solution
Officially support a fetch option on the public clients for v5
Or if can, is there any official guidance / support for handling such scenarios?
Alternatives and current workarounds
No response
Additional context
No response