There are some methods from the Management Client failing and returning this error:
FetchError: The request failed and the interceptors did not return an alternative response
at BaseAPI.fetch (/.../api/node_modules/auth0/dist/cjs/lib/runtime.js:84:27)
at async OAuth.request (/.../api/node_modules/auth0/dist/cjs/lib/runtime.js:115:26)
at async grant (/.../api/node_modules/auth0/dist/cjs/auth/base-auth-api.js:84:22) {
cause: TypeError: Cannot construct a Request with a Request object that has already been used.
at node:internal/deps/undici/undici:12618:11
at propagateAslWrapper (/.../api/node_modules/async-listener/index.js:504:23)
at /.../api/node_modules/async-listener/glue.js:188:31
at /.../api/node_modules/async-listener/index.js:541:70
at /.../api/node_modules/async-listener/glue.js:188:31
}
Here is a snippet that is throwing the error:
export const getPermissionsManagementConfigs = async (clientId: number) => {
try {
const { managementConfigs } = (await configs({
clientId,
})) as IAuth0Config;
console.log('managementConfigs: ', managementConfigs);
// const { domain, audience, clientSecret } = managementConfigs;
const client = new ManagementClient({
domain: '****,
clientId: '****',
clientSecret:
'****',
});
console.log('client: ', client.roles);
const { data: roles } = await client.roles.getAll().catch(err => {
console.log('error getting roles: ', err);
throw new Error('ERROR GETTING ROLES');
});
return { client, roles, managementConfigs };
} catch (err) {
const error = processError(err);
throw new Error(
`ERROR GETTING PERMISSIONS MANAGEMENT CONFIGS: ${error}`,
);
}
};
***IMPORTANT ***
The domain
, clientId
, and clientSecret
have been triple checked for correctness.
The error seems to indicated that the sdk library is trying reuse a Request object.
Are there any solutions to this?