How to call canister method from a rust main program?

I’m trying to call canister method from a rust program/axum server endpoint,
I have deployed canister code locally using dfx start command.

I followed code given at ic-agent docs - ic_agent - Rust

In my canister code:

fn get_some_id() -> String {


service : {
  get_some_id : () -> (text) query;

And in my i have function which connects to canister using ic-agent

async fn connect_to_canister() -> String {
// connecting local replica
    let agent = Agent::builder()

    let canister_id = Principal::from_text("local-canister-id-cai").unwrap();
    let empty_args: Vec<u8> = Encode!();
// OR
//    let empty_args: Vec<u8> = Encode!( () );
// OR
//    let empty_args: Vec<u8> = vec![68, 73, 68, 76, 0, 0];

    match agent
        .query(&canister_id, "get_some_id")
        Ok(resp) => Decode!(resp.as_slice(), String).unwrap(),
        Err(error) => error.to_string(),

Its giving me error:

Query signature verification failed.

Is this issue related to method signature mismatch? Or is it related to identity or certificate?
Also, how do I debug it from replica side, as there are no debug logs coming up when i use ‘dfx start -v’

1 Like

This is a known issue at the moment, see this discord answer

Try downgrading ic-agent for now

1 Like

Thanks a lot @Samer !
It worked with .with_verify_query_signatures(false) with version 0.30.
For now will do that until dfx gets upgraded.