vscode-infracost icon indicating copy to clipboard operation
vscode-infracost copied to clipboard

Error infracost register behind proxy

Open olahouze opened this issue 2 years ago • 6 comments

Hello

Context

I'm in a company that filters the internet flow behind a web proxy

When I want to make the following order

infracost register

I have an error

Error: Error sending API request: Post "https://dashboard.api.infracost.io/apiKeys?source=cli-register": dial tcp 3.139.172.42:443: i/o timeout

Request

Can you add a functionality to allow to configure the module with a web proxy ?

Sincerely

olahouze avatar Jul 08 '22 07:07 olahouze

Hi @olahouze. Have you set a https_proxy environment variable in your terminal to point to your company's HTTPS proxy server? I think this should work

To unblock you just now though, you can sign up directly at https://dashboard.infracost.io/ and retrieve an API key from your "Org Settings".

aliscott avatar Jul 08 '22 08:07 aliscott

Hi @alikhajeh1 I set up all required env variables to use proxy but getting the error below

main└─ $ infracost breakdown --path .
Evaluating Terraform directory at .
  ✔ Downloading Terraform modules 
  ✔ Evaluating Terraform directory 
  ✖ Retrieving cloud prices to calculate costs 

Error: Invalid API response: 401 authenticationrequired
We have been notified of this issue.

SerhiiSokolov avatar Sep 05 '22 06:09 SerhiiSokolov

Hi @olahouze. Have you set a https_proxy environment variable in your terminal to point to your company's HTTPS proxy server? I think this should work

Hello

I don't have the rights on my company's computer to modify the environment variables. Here is the reason of my request: to be able to pass the proxy parameters directly in the command line of the tool (for that I have the rights)

To unblock you just now though, you can sign up directly at https://dashboard.infracost.io/ and retrieve an API key from your "Org Settings".

Good news but same problem : after put API KEY, communication KO because no proxy parameter

Sincerely

olahouze avatar Sep 05 '22 11:09 olahouze

Hi @alikhajeh1 I set up all required env variables to use proxy but getting the error below

@SerhiiSokolov this looks like it's still hitting the proxy. Do you have the exact commands you ran to set the proxy variables?

aliscott avatar Sep 05 '22 17:09 aliscott

Good news but same problem : after put API KEY, communication KO because no proxy parameter

@olahouze out of interest does it work if you add the env var inline and run the infracost cli manually, e.g:

https_proxy=https://<PROXY> infracost breakdown ...

Another option we might have is to include it in the Infracost config file once we add support for that to VS Code.

aliscott avatar Sep 05 '22 17:09 aliscott

@olahouze we just released a new version of the Infracost VS Code Extension (v0.2.11) that supports using a config file. The config file also supports env variables being defined, so I was wondering if you could possibly test that?

alikhajeh1 avatar Jun 07 '23 21:06 alikhajeh1