Internet_identity.did doesn't exist

My project runs fine locally but when I try to generate or build for IC I get the following error. It seems to not create identity did when building for IC.

project git:(master) dfx generate --ic
Building canisters before generate for Motoko
WARN: .did file for canister 'icp_ledger' does not exist.
WARN: .did file for canister 'internet_identity' does not exist.
WARN: ryjl3-tyaaa-aaaaa-aaaba-cai.did:484.10-538.2: warning [M0185], importing Candid service constructor as instantiated service
Generating type declarations for canister internet_identity:
Error: Failed while trying to generate type declarations for 'internet_identity'.
Caused by: Candid file: .../projects/project/.dfx/ic/canisters/internet_identity/internet_identity.did doesn't exist.

    "internet_identity": {
      "type": "custom",
      "candid": "https://github.com/dfinity/internet-identity/releases/latest/download/internet_identity.did",
      "wasm": "https://github.com/dfinity/internet-identity/releases/latest/download/internet_identity_dev.wasm.gz",
      "remote": {
        "id": {
          "ic": "rdmx6-jaaaa-aaaaa-aaadq-cai"
        }
      },
      "frontend": {}
    },

      "remote": {
        "candid": "https://github.com/dfinity/internet-identity/releases/latest/download/internet_identity.did",
        "id": {
          "ic": "rdmx6-jaaaa-aaaaa-aaadq-cai"
        }
      },

should work. The ‘remote’ feature was built with mandatory remote.candid field in mind but for some reason that restriction didn’t make it into the code. We do have a ticket to fix that already

I’m having this same issue even with your fix @Severin

{
  "canisters": {
    "internet_identity": {
      "type": "custom",
      "wasm": "https://github.com/dfinity/internet-identity/releases/latest/download/internet_identity_dev.wasm.gz",
      "candid": "https://github.com/dfinity/internet-identity/releases/latest/download/internet_identity.did",
      "frontend": {},
      "remote": {
        "candid": "https://github.com/dfinity/internet-identity/releases/latest/download/internet_identity.did",
        "id": {
          "ic": "rdmx6-jaaaa-aaaaa-aaadq-cai"
        }
      }
    },
    "icrc1_ledger": {
      "type": "custom",
      "candid": "https://raw.githubusercontent.com/dfinity/ic/3d0b3f10417fc6708e8b5d844a0bac5e86f3e17d/rs/rosetta-api/icrc1/ledger/ledger.did",
      "wasm": "https://download.dfinity.systems/ic/3d0b3f10417fc6708e8b5d844a0bac5e86f3e17d/canisters/ic-icrc1-ledger.wasm.gz"
    },
    "minter_backend": {
      "declarations": {
        "node_compatibility": true
      },
      "main": "src/minter_backend/main.mo",
      "type": "motoko"
    },
    "coinflip_frontend": {
      "dependencies": [
        "minter_backend",
        "icrc1_ledger"
      ],
      "source": [
        "src/coinflip_frontend/dist",
        "src/coinflip_frontend/src"
      ],
      "type": "assets",
      "workspace": "coinflip_frontend"
    }
  },
  "defaults": {
    "build": {
      "args": "",
      "packtool": "mops sources"
    }
  },
  "output_env_file": ".env",
  "version": 1
}

Error:

theo@Theos-MacBook-Pro-2 coinflip % dfx build --all --ic
Building canisters...
WARN: .did file for canister 'internet_identity' does not exist.
WARN: /Users/theo/Desktop/ICP/production/coinflip/src/minter_backend/main.mo:22.8-22.14: warning [M0194], unused identifier Cycles (delete or rename to wildcard `_` or `_Cycles`)
/Users/theo/Desktop/ICP/production/coinflip/src/minter_backend/main.mo:23.8-23.12: warning [M0194], unused identifier Iter (delete or rename to wildcard `_` or `_Iter`)

Building frontend...
Error: Failed while trying to build all canisters.
Caused by: The post-build step failed for canister '76j6z-pqaaa-aaaal-ajvqq-cai' (coinflip_frontend)
Caused by: Failed to build frontend for network 'ic'.
Caused by: The command 'cd "/Users/theo/Desktop/ICP/production/coinflip" && CANISTER_CANDID_PATH="/Users/theo/Desktop/ICP/production/coinflip/.dfx/ic/canisters/coinflip_frontend/assetstorage.did" CANISTER_CANDID_PATH_ICRC1_LEDGER="/Users/theo/Desktop/ICP/production/coinflip/.dfx/ic/canisters/icrc1_ledger/icrc1_ledger.did" CANISTER_CANDID_PATH_MINTER_BACKEND="/Users/theo/Desktop/ICP/production/coinflip/.dfx/ic/canisters/minter_backend/minter_backend.did" CANISTER_ID="76j6z-pqaaa-aaaal-ajvqq-cai" CANISTER_ID_COINFLIP_FRONTEND="76j6z-pqaaa-aaaal-ajvqq-cai" CANISTER_ID_ICRC1_LEDGER="7xkvf-zyaaa-aaaal-ajvra-cai" CANISTER_ID_INTERNET_IDENTITY="rdmx6-jaaaa-aaaaa-aaadq-cai" CANISTER_ID_MINTER_BACKEND="7ziyn-ciaaa-aaaal-ajvqa-cai" DFX_NETWORK="ic" DFX_VERSION="0.24.2" NODE_ENV="production" "npm" "run" "build" "--workspace" "coinflip_frontend"' failed with exit status 'exit status: 255'.
Stdout:

> coinflip_frontend@0.0.0 prebuild
> dfx generate


Stderr:
Building canisters before generate for Motoko
WARN: .did file for canister 'internet_identity' does not exist.
WARN: 7xkvf-zyaaa-aaaal-ajvra-cai.did:485.11-513.2: warning [M0185], importing Candid service constructor as instantiated service
/Users/theo/Desktop/ICP/production/coinflip/src/minter_backend/main.mo:22.8-22.14: warning [M0194], unused identifier Cycles (delete or rename to wildcard `_` or `_Cycles`)
/Users/theo/Desktop/ICP/production/coinflip/src/minter_backend/main.mo:23.8-23.12: warning [M0194], unused identifier Iter (delete or rename to wildcard `_` or `_Iter`)

Generating type declarations for canister minter_backend:
  /Users/theo/Desktop/ICP/production/coinflip/src/declarations/minter_backend/minter_backend.did.d.ts
  /Users/theo/Desktop/ICP/production/coinflip/src/declarations/minter_backend/minter_backend.did.js
  /Users/theo/Desktop/ICP/production/coinflip/src/declarations/minter_backend/minter_backend.did
Generating type declarations for canister internet_identity:
Error: Failed while trying to generate type declarations for 'internet_identity'.
Caused by: Candid file: /Users/theo/Desktop/ICP/production/coinflip/.dfx/ic/canisters/internet_identity/internet_identity.did doesn't exist.
npm error Lifecycle script `build` failed with error:
npm error code 255
npm error path /Users/theo/Desktop/ICP/production/coinflip/src/coinflip_frontend
npm error workspace coinflip_frontend@0.0.0
npm error location /Users/theo/Desktop/ICP/production/coinflip/src/coinflip_frontend
npm error command failed
npm error command sh -c dfx generate

The issue with dfx generate (that’s what you’re running into) is already fixed on master. Should be in the next release. As a workaround you can try dfx build --check before dfx build --ic. As a last resort you can also try putting the did file there manually

Got it, it was working in v0.20.1, so going to just downgrade back for now.

1 Like