Cannot fetch candid file

I am having issues accessing a canister through the candid web interface.

Canister works fine, deploy works fine and accessing canister from frontend/other canisters work fine. It is just the generated web interface that says “Cannot fetch candid file”.

Deploy 1:

"ic_siwe_provider": {
  "type": "custom",
  "candid": "https://github.com/kristoferlund/ic-siwe/releases/download/v0.0.4/ic_siwe_provider.did",
  "wasm": "https://github.com/kristoferlund/ic-siwe/releases/download/v0.0.4/ic_siwe_provider.wasm.gz"
},

Deploy 2:

"ic_siwe_provider": {
  "type": "custom",
  "candid": "https://raw.githubusercontent.com/kristoferlund/ic-siwe/09cb809d6b94edea17c9d0c96bffdb845dbea1d3/packages/ic_siwe_provider/ic_siwe_provider.did",
  "wasm": "https://github.com/kristoferlund/ic-siwe/raw/09cb809d6b94edea17c9d0c96bffdb845dbea1d3/packages/ic_siwe_provider/ic_siwe_provider.wasm.gz"
},

Am I missing something obvious here? :grinning:

Your build process probably does not add the candid file to the metadata. If you want dfx to add it automatically when deploying you have to tell it to add it like this. If you want to do it manually in your build process you can do it with ic-wasm (installed via cargo install ic-wasm)

1 Like

Is this a potential breaking change, @Severin? In other words, could it be that older versions of dfx automatically included the did metadata, but now this feature requires opting in?

Maybe it has always been an opt-in feature but, I’m asking because I feel like this is the second similar question I’ve encountered this week.

Oh, the existence of the metadata section I had missed completely. :grinning: Is the rationale here that you probably don’t want to include the did metadata for a production canister but that it might be nice during development?

You’re right, this was a breaking change that was not labelled as such. However, it was merged in October 2022 and released in dfx 0.12.0, so I don’t think anything this week should really be an effect of that. (Maybe important detail: it’s only breaking for canisters of type custom)

No, it’s about giving full control. If you say you build your wasm yourself (canister type custom) and then we go and change it before installing that’s unexpected. So we decided to make it opt-in instead of opt-out. Another expected use case would be that you may want to have debug methods in the candid file when you build non-release builds, so you add your own logic about when to add which metadata section.

I would actually suggest that you include the metadata for a production canister if you want others to be able to integrate with your project. That way the dashboard and similar services can also show what functions your canister offers

3 Likes