Inter canister query call error

Hello,

I’m currently using inter-canister calls to retrieve info from canister B to canister A and back to the user like this :

User asks for data related to x --> A.query(x) --> B.query(x) --back to A with response y--> A[y] --> back to the User with y

Works perfectly locally.

But it fails hard on the IC with this error :

The Replica returned an error: code 5, message: "IC0504: Canister x5nnp-fqaaa-aaaal-qauuq-cai violated contract: "ic0_call_new" cannot be executed in non replicated query mode"

The only work around I’ve found is to convert my entry endpoint to an update call. (A.query(x) to A.update(x)).
But now it takes around 10sec to execute instead of being instantaneous (and it’s more costly)… This is not a good solution for me as our app needs to run at full speed for a descent user experience.

I would be so thankful if somebody could help me on this one.

Cheers

P.S. : Using dfx 0.8.4, it might have been fixed with newer version, but I could not find anything about it. And I cannot upgrade dfx yet.

Hi @dymayday

Inter-canister query calls are not supported currently. There is an ongoing discussion here: Inter-Canister Query Calls (Community Consideration) - #53 by ulan
Until the discussion is resolved, the best workaround is to move the query calling logic to the client side, so that the browser performs both queries to A and B.

Looks like dfx unintentionally enables the (incomplete) prototype implementation of inter-canister query calls. (The technical reason is that the prototype is enabled for system subnets and dfx uses a system subnet configuration). The SDK team is working on switching dfx from the system subnet config to the application subnet config with many additional benefits like proper cycle accounting. Once the work is complete, the discrepancy that you’ve discovered will be fixed.

IIUC, the title of the post about losing access to canister doesn’t seem related to the contents. Did you mean to use a different title here?

4 Likes

Thanks a lot for your answer !
I’ll implement this workaround then and eagerly wait for this feature in the mean time :+1:

Indeed I had this issue in a draft (only principal id was part of the controller list, not wallet-id) and forgot to update the title but I fixed it by deploying a whole new canister to the IC :sweat_smile:

4 Likes