Dfx deploy --argument does not infer Candid types

If you deploy a Rust canister (Azle/Kybra included) with an “empty” candid file:

service : () -> {
}

but your canister accepts init or post_upgrade params, then deploy will fail because dfx doesn’t seem to detect or encode the argument. Why is this?

dfx seems to do a lot of Candid inference in other places such as during dfx canister call method calls. Having an empty Candid file like above doesn’t break all method calls, so shouldn’t dfx deploy --argument work similarly?

This is causing issues in Kybra because of some complicated build issues we’re having around the Candid situation on the IC for Rust/custom canisters. Just bringing it up.

If you want to bypass the type check, use dfx canister install --wasm a.wasm --argument '(init args)'

1 Like