The Replica returned an error: code 3, message: "Canister ryjl3-tyaaa-aaaaa-aaaba-cai has no update method 'top'"

326 views Asked by At

I started develop in Motoko Programming Language. I try call function from my terminal but when I enter: dfx canister call dbankk_backend topUp

import Debug "mo:base/Debug";

actor Dbank {
  var currentValue = 300;
currentValue := 100;

//like const variable
// let id = 534543546543;

//Debug.print(debug_show(currentValue));

public func topUp() {
  currentValue += 2;
  Debug.print(debug_show(currentValue));
};

// top();

}

But it says:

Error: Failed update call.
Caused by: Failed update call.
The Replica returned an error: code 3, message: "Canister ryjl3-tyaaa-aaaaa-aaaba-cai has no update method 'topUp'"

Terminal

I expect to see in terminal that CurrentValue growing up in 2.

2

There are 2 answers

0
Abdurrahman Yabani On

Try running dfx deploy and running the command again. The Canister was probably updated in the code but has not been deployed to make the changes, so the function topUp has not been compiled.

2
thegithaka On

I agree with running dfx deploy after exposing your topUp function then proceeding to run dfx canister call <your project> topUp. You see, when you make some changes on your motoko file, how will it know about the changes?