You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: use node-fetch for data downloads to avoid Axios proxy issues (#353)
We've seen users hit various issues with Axios and their HTTP proxies. I've been able to reproduce the first issue below running a squid proxy locally. Switching to node-fetch for the data download seems to fix this.
Axios issues:
* axios/axios#2452
* axios/axios#5256
'You do not have permission to download data. Please set a valid INFRACOST_API_KEY.'
40
-
);
36
+
if(!latestResp.ok){
37
+
constbody=latestResp.body.read().toString();
38
+
41
39
config.logger.error(
42
-
'A new key can be obtained by installing the infracost CLI and running "infracost auth login". The key is usually saved in ~/.config/infracost/credentials.yml'
40
+
`There was an error downloading data: HTTP ${latestResp.status}: ${body}`
43
41
);
44
-
}else{
45
-
config.logger.error(`There was an error downloading data: ${e.message}`);
'You do not have permission to download data. Please set a valid INFRACOST_API_KEY.'
51
+
);
52
+
config.logger.error(
53
+
'A new key can be obtained by installing the infracost CLI and running "infracost auth login". The key is usually saved in ~/.config/infracost/credentials.yml'
54
+
);
55
+
}
56
+
}catch(e){
57
+
// eslint-disable no-empty
58
+
// We don't care if the body is not valid JSON since we log it above anyway
59
+
}
60
+
61
+
process.exit(1);
46
62
}
63
+
}catch(e){
64
+
config.logger.error(`There was an error downloading data: ${e}`);
0 commit comments