Inconsistent behaviour of agent 2.1.2 on #[inspect_message]

Good afternoon. I am working on the implementation of #[inspect_message] in our project and I encountered unexpected behavior of the Dfinity agent.

I have simple function:

#[update]
async fn create_account() -> HttpResponse<AccountResponse> {
    trap("Not proxy")
}

Response CLI:

The replica returned a rejection error: reject code CanisterError, reject message Error from Canister 74gpt-tiaaa-aaaak-aacaa-cai: Canister called `ic0.trap` with message: Not proxy.

And I have simple test:

try {
    await actor.create_account();
    fail("Have to fail");
} catch (e) {
    console.log(JSON.stringify(e.message));
    expect(e.message).contains("required");
}

Agent Version: 0.17.0

Response:

Call was rejected:\n  Request ID: 75695d868d7dc746938ee52f106733c101461e03963928ed6d7f3cd8a0637866\n  Reject code: 5\n  Reject text: Error from Canister 74gpt-tiaaa-aaaak-aacaa-cai: Canister called `ic0.trap` with message: Not proxy.

The first oddities begin after upgrading the agent to version 2.1.2. As you can see, the response no longer contains the expected ā€œNot proxyā€ message.

Call failed:\n  Canister: 74gpt-tiaaa-aaaak-aacaa-cai\n  Method: create_account (update)\n  \"Request ID\": \"655aebd3f81c94fb2508a7b44003cb36b09a6296c78a1104a67a5620ed08cc67\"\n  \"Reject code\": \"undefined\"\n  \"Reject message\": undefined

Further unexpected behavior increases

I add one more function with inspect_message macro:

#[inspect_message]
async fn inspect_message() {
    trap("Error from proxy")
}

CLI Response:

The replica returned a rejection error: reject code CanisterError, reject message Error from Canister 74gpt-tiaaa-aaaak-aacaa-cai: Canister called `ic0.trap` with message: Error from proxy.

Agent Version: 0.17.0

Call failed:\n  Canister: 74gpt-tiaaa-aaaak-aacaa-cai\n  Method: create_account (update)\n  \"Request ID\": \"9248ac9b07c09ceb120620e10091232ea6066235df2cd42bc06e50fa5273aeb4\"\n  \"Error code\": \"IC0503\"\n  \"Reject code\": \"5\"\n  \"Reject message\": \"Error from Canister 74gpt-tiaaa-aaaak-aacaa-cai: Canister called `ic0.trap` with message: Error from proxy.\

But for version 2.1.2 Iā€™m getting something totally unexpected:

Call was returned undefined, but type [[object Object]].

Can someone help answer questions:

  • Where did the message text go in version 2.1.2 for the trap in update call?
  • What should be done to get the expected trap response in the #inspect_message request for version 2.1.2?

Thanks,
Oleksii

1 Like

fixed in 2.1.3

Thanks

1 Like