DFX12.1 canister import don't work anymore when deploying single canister

Hey community,

I have a little issue breaking my deplyment pipelines since migrating to dfx 12.1.
dfx deploy --network=xxx works fine to deploy all the canisters
Yet, deploying a single does not work and throw an error I have never faced before:

All canisters have already been created.
Building canisters...
Error: Failed while trying to deploy canisters.
Caused by: Failed while trying to deploy canisters.
  Failed to build call canisters.
    Failed while trying to build all canisters.
      [...]
Stdout:

Stderr:
/Users/shef/projects/theshelf/dfinity-infra/backend/dfinity/user_db/user_db.mo:17.1-17.47: import error [M0009], file "/Users/shef/projects/theshelf/dfinity-infra/.dfx/ic/canisters/idl/aq43c-6yaaa-aaaao-aaxfa-cai.did" does not exist

The line in question is canister import:
import SocialNetwork "canister:social_network";

The reason why I need this, is that I need to deploy --mode=reinstall quite frequently, which only works for single-canister deploys.

Any idea how I can resolve this?

What version were you using previously and do you have something that I could play around with? I’ve seen the same error a few times now but couldn’t get my hands on an example to test a potential fix on

I was using dfx 11.2 previously.
I don’t have enoigh resource to build an example right now, but as you’re part of the dfinity team, I guess I could give you acces to the codebase temporarily - would that work for you?

Yes, thank you, that would be great! My GH user is sesi200 (Severin Siffert) · GitHub

Will be fixed in this PR: fix: dfx deploy --mode reinstall for single canisters fails because of dependent canisters by sesi200 · Pull Request #2779 · dfinity/sdk · GitHub

1 Like

just an fyi regarding the current fix: the same error still get thrown if the deployer’s identity is not authorized.
Without the --mode=reinstall, the CLI would return: The replica returned an HTTP Error: Http Error: status 403 Forbidden, content type "application/cbor", content: Only controllers of canister aq43c-6yaaa-aaaao-aaxfa-cai can call ic00 method install_code, which makes sense.
Perhaps a little misleading for people who are not in the know :wink:

Anyway, thought you might want to know as you were interested in this original error message

Clarification: You mean you still get a compilation error if you use a different identity? In the test case I wrote I get a 403 forbidden in both cases.