dfx generate bug
Open
Nobody has claimed this yet.
accepted
bug
triaged
- Dominant language
- Rust
- Stars
- 204
- Forks
- 98
- PR merge metrics
- No merged PRs in 30d
Description
I tried the following:
- include the ledger in a project with the following
dfx.json
"canisters": {
"ledger": {
"type": "custom",
"wasm": "ledger.wasm",
"candid": "ledger.private.did",
"remote": {
"candid": "ledger.public.did",
"id": {
"ic": "ryjl3-tyaaa-aaaaa-aaaba-cai"
}
}
},
"trax_payments_backend": {
"main": "src/trax_payments_backend/main.mo",
"type": "motoko",
"dependencies": ["ledger"]
}
},
"defaults": {
"build": {
"args": "",
"packtool": ""
}
},
"version": 1
}
- deploy the ledger, swap
ledger.private.didtoledger.public.didin thedfx.json - include the ledger in another canister
Ausingimport Ledger "canister:ledger - deploy that canister
Aas well - run
dfx generate A
I expected to see this happen: dfx generates the bindings for canister A
Instead, this happened:
dfx fails with the following output
❯ dfx generate trax_payments_backend
Building canisters before generate for Motoko
Error: Failed while trying to build all canisters.
Caused by: Failed while trying to build all canisters.
The build step failed for canister 'r7inp-6aaaa-aaaaa-aaabq-cai' (trax_payments_backend) with an embedded error: Failed to build Motoko canister 'trax_payments_backend'.: Failed to compile Motoko.: Failed to run 'moc'.: The command '"/Users/moritz/.cache/dfinity/versions/0.12.1/moc" "/Users/moritz/projects/trax_payments/src/trax_payments_backend/main.mo" "-o" "/Users/moritz/projects/trax_payments/.dfx/local/canisters/trax_payments_backend/trax_payments_backend.wasm" "-c" "--debug" "--idl" "--stable-types" "--public-metadata" "candid:service" "--actor-idl" "/Users/moritz/projects/trax_payments/.dfx/local/canisters/idl/" "--actor-alias" "ledger" "rrkah-fqaaa-aaaaa-aaaaq-cai" "--actor-alias" "trax_payments_backend" "r7inp-6aaaa-aaaaa-aaabq-cai" "--package" "base" "/Users/moritz/.cache/dfinity/versions/0.12.1/base"' failed with exit status 'exit status: 1'.
Stdout:
Stderr:
/Users/moritz/projects/trax_payments/src/trax_payments_backend/main.mo:11.1-11.36: import error [M0009], file "/Users/moritz/projects/trax_payments/.dfx/local/canisters/idl/rrkah-fqaaa-aaaaa-aaaaq-cai.did" does not exist
This can be fixed by moving the ledgers did file to the path specified in the error message.
Meta
dfx --version:
12.0.1
Further log output
<log output>
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the dfx generate command and the build step described in the report, using the supplied dfx.json and Motoko main.mo import as the reproduction. Check how the ledger.did file is placed under .dfx/local/canisters/idl; done means dfx generate A builds successfully and generates bindings without the missing-file error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100