How to create .wasm file for a non-deployed actor?

I try to upgrade partition canisters of my distributed database from JavaScript code.

So, I try to load the file .dfx/local/canisters/NacDBPartition/NacDBPartition.wasm.

But this file does not exist, because I don’t deploy by DFX NacDBPartition (it is to be deployed by another actor, NacDBIndex).

So, I don’t know how to produce the .wasm file for NacDBPartition (without also deploying it by DFX, what would create an extra useless canister, because NacDBPartition should be deployed only by NacDBIndex).

Please, help.

Motoko right? You want a workaround?

Add the canister to your dfx.json. Then you do a dfx deploy your_canister_name and do not care about the error msg if your canister takes init param or else. Then every time you need a new wasm you run dfx build your_canister_name and you should get that .dfx/local/canisters/NacDBPartition/NacDBPartition.wasm file.

The only downside of this, if your canister takes init param, is that you cannot just do a dfx deploy to deploy everything anymore. Then you have to be specific dfx deploy frontend etc.

Also always pay attention at the timestamp of the generated .wasm, just to be sure that the workaround correctly generated it.

If my canister doesn’t take an init param, dfx deploy your_canister_name will create the canister. But in my question I explained that I don’t want to.

It creates the canister, even if it takes init params. My question was how NOT to create it.

A working solution is to call

moc `vessel sources` ...

from my Makefile.

1 Like