Rust-web3 - web3.eth().balance(accounts[0], None).await?; - Error: Api(Transport("Unexpected response status code: 400 Bad Request"))

Hi all,

Trying to getBalance in Infura with rust-web3, but getting;
Error: Api(Transport("Unexpected response status code: 400 Bad Request"))

Using uri;
let transport = web3::transports::Http::new("https://:<secret>@ropsten.infura.io/v3/<project-id>")?;

The method call;
let ibalance = web3.eth().balance(accounts[0], None).await?;

The same call works fine with web3.js.
Someone can give me a clue?

Can I access logs in Infura to see whats happening behind the scene?
Thanks in advance.

I found that the error only occurs when using basic authentication.
I’m using the following url with the “:” before the secret;
"https://:<secret>@ropsten.infura.io/v3/<project-id>"

That’s correct?

Hi @fjrojas-ws, and welcome to the Infura community! Try it without the “:” before the secret :slight_smile: