Describe the bug
If you import the FireBlocks SDK it in turn imports:
import PIIsdk from "@notabene/pii-sdk";
(See pii-client.d.ts)
This in turn runs the following code:
const $cc4675d9e8e3b77e$var$errorInterceptor = (error)=>{
return Promise.reject({
req: {
url: "" + error?.response?.config?.baseURL + error?.response?.config?.url,
method: error?.request?.method
},
status: error?.response?.status,
statusText: error?.response?.statusText,
err: JSON.stringify(error?.response?.data?.err || error?.response?.data || error)
});
};
(0, ($parcel$interopDefault($iyY9t$axios))).interceptors.request.use((res)=>res, (error)=>$cc4675d9e8e3b77e$var$errorInterceptor(error));
(0, ($parcel$interopDefault($iyY9t$axios))).interceptors.response.use((res)=>res, (error)=>$cc4675d9e8e3b77e$var$errorInterceptor(error));
This sets a default Axios interceptor, from now on any Axios errors will use errorInterceptor which transforms the usual Axios error that has fields like error.request.method into this new (custom?) format that has fields like error.req.method
This is confusing and unexpected; I would expect FireBlocks to decorate their own Axios instance as they desire, but leave all other Axios instances alone.
To Reproduce
import { FireblocksSDK } from 'fireblocks-sdk';
import * as axios from 'axios';
new FireblocksSDK("Some secret", "API key");
// Expect: 0
// Actual: 1
console.log(axios.default.interceptors.response.handlers.length);
Expected behavior
No default interceptors should be registered; these interceptors should only be registered on the FireBlocks-SDK-internal axios instance
Version:
fireblocks-sdk version: 5.33.0
- npm version: 10.8.2
- node version: v20.18.0
Describe the bug
If you import the FireBlocks SDK it in turn imports:
(See
pii-client.d.ts)This in turn runs the following code:
This sets a default Axios interceptor, from now on any Axios errors will use
errorInterceptorwhich transforms the usual Axios error that has fields likeerror.request.methodinto this new (custom?) format that has fields likeerror.req.methodThis is confusing and unexpected; I would expect FireBlocks to decorate their own Axios instance as they desire, but leave all other Axios instances alone.
To Reproduce
Expected behavior
No default interceptors should be registered; these interceptors should only be registered on the FireBlocks-SDK-internal axios instance
Version:
fireblocks-sdkversion: 5.33.0