Upgrading the application previously installed not working

I have deployed an application on the IC. Now I am testing to upgrade the canister in the project.
I am following this article to do so.

When I execute the command

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

it runs successfully and shows me something like this,

Module hash a334247f3bb1853f22d7badd15f4e4ea83dde95229f1d3c88f635e87cc9d9b40 is already installed.
Module hash 183df2eb0f1846054e26e3ed17308c65dd0c7af079cd8896406dd959691004bb is already installed.
Uploading assets to asset canister...
Starting batch.
Staging contents of new and changed assets:
  /main.css (1986 bytes) sha aec349eab9d01da3b311a12ceb64b20a2a0266c192455e006c6c2f3918a0f243 is already installed
  /main.css (gzip) (783 bytes) sha a8a52cfed79e9d4802365b851a01cfaff7bde8f57d55aefe61a03d2b77734d8e is already installed
  /favicon.ico (15406 bytes) sha 4e8d31b50ffb59695389d94e393d299c5693405a12f6ccd08c31bcf9b58db2d4 is already installed
  /sample-asset.txt (24 bytes) sha 2d523f5aaeb195da24dcff49b0d560a3d61b8af859cee78f4cff0428963929e6 is already installed
  /index.js (265008 bytes) sha dac13cfb172f0552615b59d212c7d571739ea7f2324e2e639bbea628d8827f11 is already installed
  /index.js (gzip) (90864 bytes) sha 949d3d963ebe54690a58dbdf22ac47dad34c9a1a6b2ef1c1696442cdfc77a0a7 is already installed
  /index.js.LICENSE.txt (413 bytes) sha f2dcfd36875be0296e171d0a6b1161de82510a3e60f4d54cc1b4bec0829f8b33 is already installed
  /index.js.LICENSE.txt (gzip) (274 bytes) sha 4589e957ca0efa4634c545e402453a1aee6b18be3022dbb040bd0ab7d96c5077 is already installed
  /logo2.svg (15139 bytes) sha 037eb7ae523403daa588cf4f47a34c56a3f5de08a5a2dd2364839e45f14f4b8b is already installed
  /index.js.map (756440 bytes) sha 547777ad5cc005bea23f7da122fb1949a2422f9a93a87cc8c37ad7d5291e425d is already installed
  /index.js.map (gzip) (169010 bytes) sha 62e50ea005b3baddd2775b84ec84b59721ed633bfd167d9618e9d5b70b4b986b is already installed
  /index.html (2750 bytes) sha a66b84a50397e4000ebca538f8327a5dea61e6d4474e10b2c9cad360a09f29eb is already installed
  /index.html (gzip) (1028 bytes) sha 83babf3028304b69cc31eb6c7ff299b52c89147989cda68af5dd9b196e325d1c is already installed
Committing batch.

But nothing get upgrade :no_mouth:

Is the command not workable?
**also tried to use “deploy” command which works though. But my concern is why it is not upgrading.

That because there’s no changes in the project and DFX doesn’t find any new assets to upload

But I made a changes in the frontend file (index.html), mainly for testing only…

Maybe you forgot to save.

If you see these lines in the log you posted,

/index.html (2750 bytes) sha a66b84a50397e4000ebca538f8327a5dea61e6d4474e10b2c9cad360a09f29eb is already installed
/index.html (gzip) (1028 bytes) sha 83babf3028304b69cc31eb6c7ff299b52c89147989cda68af5dd9b196e325d1c is already installed

DFX calculated the hash for your index.html file and found no changes to the already present file, hence did not upload it again.

Also in your dfx.json file that lists all your canisters, the asset canister listed has a source entry.

Ensure that the changes you made are included there or compiles to an output that is included there

That is what my concern is, I am changing the content of the file and trying to upgrade it. But why does it responding to that?

**I have saved the file.

Does it work for you? I have delete everything from my index.html file and try to update it. It shows me the same msg and interestingly the frontend doesn’t change anything!

Do we need to run any other command after that?

Note: The dfx deploy works fine though. It change the required changes.

dfx deploy runs these 3 commands. You can run them yourself:

dfx canister create --all
dfx build
dfx canister install --all

Looks like you are only running install. If you don’t run dfx build before it, it will not recompile your frontend into a new wasm that contains the changed code. That is what you’re probably running into

2 Likes

Bravo!! It works!
The command goes like this,

dfx canister --network ic create --all
dfx build
dfx canister --network ic install --all --mode upgrade

Thank you!! :innocent:

2 Likes

I actually believe the asset canister Wasm doesn’t change when you change the assets to upload to it. The assets aren’t baked into the Wasm during build, rather dfx runs icx-asset to check if any assets changed and have to be uploaded/removed.

1 Like