Upgrade canister on ic with new dfx version

I have an existing canister on mainnet that was deployed with 0.8.4. I want to use the new heartbeat functionality with motoko in 0.9.0. If I try to upgrade my canister on the ic with dfx 0.9.0, I get error:

The replica returned an HTTP Error: Http Error: status 403 Forbidden, content type "", content: Requested canister rejected the message

How do I upgrade my canister code with dfx 0.9.0 (I obviously cannot reinstall my code and lose state)?

1 Like

Might be related to Dfx generate failing in 0.9.0, not sure…

1 Like

Running into the same problem.

UPD: figured it out - since --no-wallet behavior is now the default one, you have to specify a wallet to deploy from.

dfx deploy --network ic --wallet <wallet-canister-id> 
4 Likes

That seems like a problem almost every IC dev will run into. Hope they can document that somewhere…

1 Like

We will document that in the release notes - it’s not related to dfx generate, just the wallet changes.

We haven’t published those changes to smartcontracts.org yet, since there hasn’t been an official, blessed build of 0.9.x, but it is documented in the sdk changelog

2 Likes

I note that Network deployment :: Internet Computer shows dfx version 0.9.0 but the “dfx deploy” does not use the --wallet flag.

You’ll have to upgrade your wallet canister and run a command to upgrade your other canisters in order to use dfx 0.9.0. This is documented in the changelog and in the release notes. After running the steps to upgrade, you should not need the --wallet parameter.

Unfortunately we’ve published the dfx 0.9.0 release notes, as well as updated the docs to use dfx 0.9.0, but have not yet promoted dfx 0.9.0.

Breaking change: Canister commands, except for dfx canister create, will make the call directly, rather than via the user’s wallet. The --no-wallet flag is thus removed from dfx canister as its behavior is the default.

When working with existing canisters, use the --wallet flag in conjunction with dfx identity get-wallet in order to restore the old behavior.

You will need to upgrade your wallet and each of your existing canisters to work with the new system. To do so, execute the following in each of your dfx projects:

dfx wallet upgrade
dfx canister --wallet "$(dfx identity get-wallet)" update-settings --all --add-controller "$(dfx identity get-principal)"

To upgrade projects that you have deployed to the IC mainnet, execute the following:

dfx wallet --network ic upgrade
dfx canister --network ic --wallet "$(dfx identity --network ic get-wallet)" update-settings --all --add-controller "$(dfx identity get-principal)"
4 Likes

When I try to start the replica locally by dfx start --clean I get this error

dfx --version
dfx 0.9.0

dfx start --clean
Starting webserver for /_/
binding to: 127.0.0.1:52065
Feb 08 21:01:21.165 INFO ic-starter. 
Configuration: ValidatedConfig { replica_path: Some("/Users/t/.cache/dfinity/versions/0.9.0/replica"), 
replica_version: "0.8.0", log_level: Warning, cargo_bin: "cargo", cargo_opts: "", 
state_dir: "/Users/t/dev/play-ground/dfinity/ic/.dfx/state/replicated_state", 
http_listen_addr: 127.0.0.1:0, 
http_port_file: Some("/Users/t/dev/play-ground/dfinity/ic/.dfx/replica-configuration/replica-1.port"), 
metrics_addr: None, provisional_whitelist: Some(All), 
artifact_pool_dir: "/Users/t/dev/play-ground/dfinity/ic/.dfx/state/replicated_state/node-100/ic_consensus_pool", 
crypto_root: "/Users/t/dev/play-ground/dfinity/ic/.dfx/state/replicated_state/node-100/crypto", state_manager_root: "/Users/t/dev/play-ground/dfinity/ic/.dfx/state/replicated_state/node-100/state", 
registry_local_store_path: "/Users/t/dev/play-ground/dfinity/ic/.dfx/state/replicated_state/ic_registry_local_store", 
unit_delay: None, initial_notary_delay: Some(600ms), 
dkg_interval_length: None, detect_consensus_starvation: None, consensus_pool_backend: Some("rocksdb"), 
state_dir_holder: None }, Application: starter
Feb 08 21:01:21.166 INFO Initialize replica configuration "/Users/t/dev/play-ground/dfinity/ic/.dfx/state/replicated_state/ic.json5", Application: starter
Feb 08 21:01:22.199 INFO Executing "/Users/t/.cache/dfinity/versions/0.9.0/replica" "--replica-version" "0.8.0" "--config-file" "/Users/t/dev/play-ground/dfinity/ic/.dfx/state/replicated_state/ic.json5", Application: starter
Feb 08 21:01:22.566 WARN s:mah4l-zsgxh-wawlh-t4kpk-32pc2-n4thb-irypx-xolts-beg3g-b3wme-kae/n:r3c3j-qyrl4-fiucz-kj2qk-fhshq-pm2xm-7ngcu-wr5g7-qce2p-mesa2-gae/ic_p2p/advert_utils AdvertRequestBuilder::new(): advert_config = None
version: 0.7.0
 Feb 08 22:01:22.679 INFO Log Level: INFO
 Feb 08 22:01:22.680 INFO Starting server. 
Listening on http://127.0.0.1:8000/
Feb 08 21:01:23.092 WARN 
s:mah4l-zsgxh-wawlh-t4kpk-32pc2-n4thb-irypx-xolts-beg3g-b3wme-kae/n:r3c3j-qyrl4-fiucz-kj2qk-fhshq-pm2xm-7ngcu-wr5g7-qce2p-mesa2-gae/ic_consensus/payload_builder max_block_payload_size too small. 
current value: 0, required minimum: 3670016! max_block_payload_size must be larger than max_ingress_bytes_per_message and MAX_XNET_PAYLOAD_IN_BYTES. Update registry!

Yes, you can ignore this warning. It’s described in the release notes:

1 Like

Thanks for the reply.

I have tried to upgrade the wallet but I keep getting this error.

dfx wallet --network ic upgrade

The replica returned an HTTP Error: Http Error: status 403 Forbidden, content type "", content: Requested canister rejected the message

dfx -V
dfx 0.9.0

And I made sure my principal is the controller of the wallet.

Not sure if this has something to do with it but my deployed production wallet has more than one controller.

Omg I was stuck on this for like 3 hours. Thanks for this!

1 Like

I have exactly the same error. When I create cans in the operation and fill the data (Blob) into them. The local environment freezes and even restarting dfx does not help. We have to build new canisters of services.Something like that…

ic_consensus/payload_builder max_block_payload_size too small. current value: 0, required minimum: 3670016! max_block_payload_size must be larger than max_ingress_bytes_per_message and MAX_XNET_PAYLOAD_IN_BYTES. Update registry!