Closed fireridlle closed 2 years ago
You can also get the same error with
const client = new CoinGeckoClient({
timeout: 10000,
autoRetry: true,
});
useEffect(() => {
console.log(client.ping());
}, []);
@samuraitruong
@erkanercan I haven't test this with react. Will fix the issue
@fireridlle
below are my unit test
it('/exchange/id/tickers should successful', async () => {
const aave = await client.exchangeIdTickers({ id: 'aave' });
expect(aave.name).toEqual('Aave');
expect(aave.tickers.length).toBeGreaterThan(1);
});```
I cant reproduce the issue, If you can add stack trace error it will help. I doubt that it falls into retrying and something is not quite right in that flow
This is due to https.request() not recognizing the 3rd argument in agent-base v4. So if you have a dependency that uses agent-base v4 (for example mailgun-js) then this lib will fail... Found this: https://github.com/microsoft/vscode/issues/93167
Not sure if this should be fixed here or if there is a better way to do this, but by changing your code to the below, it works: In httpGet() :
const { host, pathname, search } = new URL(url);
const options = {
host,
path: pathname + search,
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
timeout: this.options.timeout, // in ms
};
const parseJson = (input: string) => {
try {
return JSON.parse(input);
} catch (err) {
return input;
}
};
Then just use options object:
const req = https.request(options, (res) => { ...
closed #9
Get an error
node version 14.16.0