What's the proper process to upgrade a canister?

I upgraded a canister and no errors, but I checked it on ic.rocks and tried to access it, it’s not updated. I am not sure which step I did wrong?

dfx build
dfx canister install --mode upgrade

1 Like

You’ll need to include both the canister name and the --network ic flag to deploy to the mainnet, so

dfx canister --network ic install my_canister --mode upgrade

You can also try calling your canister’s public methods using dfx right after deploying

dfx canister --network ic call <canister_name> <method_name> [argument]


dfx canister --network ic call my_canister getValue

(More on the canister call command can be found here:
https://sdk.dfinity.org/docs/developers-guide/cli-reference/dfx-canister.html#_dfx_canister_call )

1 Like

thank you! yes, I need --network for on-chain upgrade