Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dfx generate should download the .did files of imported canisters (dfx.json) #4021

Open
xamandu opened this issue Nov 29, 2024 · 0 comments
Open
Labels
needs-triage This ticket needs investigation.

Comments

@xamandu
Copy link

xamandu commented Nov 29, 2024

I tried the following:

  1. Run workflow in GitHub Actions to build dfx project with custom canisters (frontend + backend)
  2. Using dfx build command sequentially for each canister

I expected to see: Build succeeds with all canisters compiled

Instead: Build fails due to missing .did files despite them being defined in dfx.json with remote URLs:

  • icrc1_ledger_canister.did
  • ledger.did
  • evm_rpc.did

The error occurs during dfx generate prebuild step as it looks for .did files in local directory path even though they are defined as remote URLs in dfx.json.

Current workaround is to use curl to download the .did files before executing dfx build or dfx generate. This affects the developer experience.

Meta

dfx --version: 0.24.0

dfx 0.24.0
Further log output

Run find . -name "ledger.did"
./node_modules/@dfinity/ledger-icp/dist/candid/ledger.did
Building canisters...
WARN: .did file for canister 'evm_rpc' does not exist.
WARN: .did file for canister 'ledger' does not exist.
WARN: .did file for canister 'icrc1_ledger_canister' does not exist.
Building canisters...
WARN: .did file for canister 'evm_rpc' does not exist.
WARN: .did file for canister 'icrc1_ledger_canister' does not exist.
Building canisters...
WARN: .did file for canister 'icrc1_ledger_canister' does not exist.
WARN: .did file for canister 'evm_rpc' does not exist.
Building frontend...
Error: Failed while trying to build all canisters.
Caused by: The post-build step failed for canister 'b77ix-eeaaa-aaaaa-qaada-cai' (landing)
Caused by: Failed to build frontend for network 'local'.
Caused by: The command 'cd "/home/runner/work/multisignature/multisignature" && CANISTER_CANDID_PATH="/home/runner/work/multisignature/multisignature/.dfx/local/canisters/landing/assetstorage.did" CANISTER_ID="b77ix-eeaaa-aaaaa-qaada-cai" CANISTER_ID_ACCOUNT="bkyz2-fmaaa-aaaaa-qaaaq-cai" CANISTER_ID_CENTRAL="bd3sg-teaaa-aaaaa-qaaba-cai" CANISTER_ID_DASH="be2us-64aaa-aaaaa-qaabq-cai" CANISTER_ID_EVM_RPC="7hfb6-caaaa-aaaar-qadga-cai" CANISTER_ID_ICRC1_LEDGER_CANISTER="br5f7-7uaaa-aaaaa-qaaca-cai" CANISTER_ID_INTERNET_IDENTITY="bw4dl-smaaa-aaaaa-qaacq-cai" CANISTER_ID_LANDING="b77ix-eeaaa-aaaaa-qaada-cai" CANISTER_ID_LEDGER="by6od-j4aaa-aaaaa-qaadq-cai" DFX_NETWORK="local" DFX_VERSION="0.[24](https://github.com/keygate-vault/multisignature/actions/runs/12090915916/job/33718593999#step:10:25).0" "npm" "run" "build"' failed with exit status 'exit status: 255'.
Stdout:

> prebuild
> npm run prebuild --workspaces --if-present


> [email protected] prebuild
> dfx generate


> [email protected] prebuild
> dfx generate


Stderr:
Generating type declarations for canister ledger:
  /home/runner/work/multisignature/multisignature/src/declarations/ledger/ledger.did.d.ts
  /home/runner/work/multisignature/multisignature/src/declarations/ledger/ledger.did.js
  /home/runner/work/multisignature/multisignature/src/declarations/ledger/ledger.did
Generating type declarations for canister landing:
  /home/runner/work/multisignature/multisignature/src/declarations/landing/landing.did.d.ts
  /home/runner/work/multisignature/multisignature/src/declarations/landing/landing.did.js
  /home/runner/work/multisignature/multisignature/src/declarations/landing/landing.did
Generating type declarations for canister internet_identity:
  /home/runner/work/multisignature/multisignature/src/declarations/internet_identity/internet_identity.did.d.ts
  /home/runner/work/multisignature/multisignature/src/declarations/internet_identity/internet_identity.did.js
  /home/runner/work/multisignature/multisignature/src/declarations/internet_identity/internet_identity.did
Generating type declarations for canister icrc1_ledger_canister:
Error: Failed while trying to generate type declarations for 'icrc1_ledger_canister'.
Caused by: Candid file: /home/runner/work/multisignature/multisignature/.dfx/local/canisters/icrc1_ledger_canister/icrc1_ledger_canister.did doesn't exist.
npm error Lifecycle script `prebuild` failed with error:
npm error code [25](https://github.com/keygate-vault/multisignature/actions/runs/12090915916/job/33718593999#step:10:26)5
npm error path /home/runner/work/multisignature/multisignature/src/dash
npm error workspace [email protected]
npm error location /home/runner/work/multisignature/multisignature/src/dash
npm error command failed
npm error command sh -c dfx generate

Generating type declarations for canister ledger:
  /home/runner/work/multisignature/multisignature/src/declarations/ledger/ledger.did.d.ts
  /home/runner/work/multisignature/multisignature/src/declarations/ledger/ledger.did.js
  /home/runner/work/multisignature/multisignature/src/declarations/ledger/ledger.did
Generating type declarations for canister landing:
  /home/runner/work/multisignature/multisignature/src/declarations/landing/landing.did.d.ts
  /home/runner/work/multisignature/multisignature/src/declarations/landing/landing.did.js
  /home/runner/work/multisignature/multisignature/src/declarations/landing/landing.did
Generating type declarations for canister internet_identity:
  /home/runner/work/multisignature/multisignature/src/declarations/internet_identity/internet_identity.did.d.ts
  /home/runner/work/multisignature/multisignature/src/declarations/internet_identity/internet_identity.did.js
  /home/runner/work/multisignature/multisignature/src/declarations/internet_identity/internet_identity.did
Generating type declarations for canister icrc1_ledger_canister:
Error: Failed while trying to generate type declarations for 'icrc1_ledger_canister'.
Caused by: Candid file: /home/runner/work/multisignature/multisignature/.dfx/local/canisters/icrc1_ledger_canister/icrc1_ledger_canister.did doesn't exist.
npm error Lifecycle script `prebuild` failed with error:
npm error code 255
npm error path /home/runner/work/multisignature/multisignature/src/landing
npm error workspace [email protected]
npm error location /home/runner/work/multisignature/multisignature/src/landing
npm error command failed
npm error command sh -c dfx generate

Error: Process completed with exit code 2[55](https://github.com/keygate-vault/multisignature/actions/runs/12090915916/job/33718593999#step:10:56).

See https://github.com/keygate-vault/multisignature/actions/runs/12090915916/workflow.

@xamandu xamandu added the needs-triage This ticket needs investigation. label Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage This ticket needs investigation.
Projects
None yet
Development

No branches or pull requests

1 participant