I am trying to upgrade an IC deployment with new code (Rust backend and vue.js frontend). It deploys nicely and works perfectly locally. The canister-ids.js file is as follows:
$ dfx canister --network ic install --mode=reinstall rust_simplifire
WARNING!
You are about to reinstall the rust_simplifire canister
This will OVERWRITE all the data and code in the canister.
YOU WILL LOSE ALL DATA IN THE CANISTER.");
Do you want to proceed? yes/No
yes
Reinstalling code for canister rust_simplifire, with canister_id redgg-aaaaa-aaaap-qaesa-cai
But the front-end canister upgrade fails as follows:
dfx canister --network ic install --mode=reinstall rust_simplifire_assets
WARNING!
You are about to reinstall the rust_simplifire_assets canister
This will OVERWRITE all the data and code in the canister.
YOU WILL LOSE ALL DATA IN THE CANISTER.");
Do you want to proceed? yes/No
yes
Reinstalling code for canister rust_simplifire_assets, with canister_id rdcas-nyaaa-aaaap-qaesq-cai
Error: No such file or directory (os error 2)
Not sure what I’m doing wrong. Any suggestions most welcome.
I think the error message might be improved in newer versions of dfx but I would compare the files you have on disk with the file paths mentioned in your dfx.json and see if something is missing.
Did you recently upgrade to newer version of dfx v0.11.0? Not sure it is related but there is a breaking change regarding assets that was announced in this thread Dfx 0.11.0 is promoted with breaking changes
I see two odd things here - the entrypoint is pointing to your dist directory. Generally Webpack uses this to determine the entrypoint for your code bundling.
Can you confirm that your npm build job is successfully outputting to dist/rust_simplifire_assets and not just dist? Providing your webpack config may help too
I seem to have found a way around the problem, Kyle. I used sudo dfx -v deploy --network ic instead of dfx canister --network ic install --mode=reinstall rust_simplifire
dfx deploy --network ic is a perfectly fine pattern, and won’t delete your canister’s state like --mode=reinstall does. If you need to use sudo, there’s something weird about your dfx installation