zensh
September 25, 2024, 4:09pm
1
$ dfx build idempotent-proxy-canister
Building canisters...
Checking for vulnerabilities in rust canisters.
Fetching advisory database from https://github.com/RustSec/advisory-db.git
Loaded 660 security advisories (from /home/tanguy/.cargo/advisory-db)
Updating crates.io index
Scanning Cargo.lock for vulnerabilities (308 crate dependencies)
Audit found no vulnerabilities.
Error: Failed while trying to build all canisters.
Caused by: The build step failed for canister 'bkyz2-fmaaa-aaaaa-qaaaq-cai' (idempotent-proxy-canister)
Caused by: Failed to build Rust canister 'idempotent-proxy-canister'.
Caused by: Failed to create <Type>CanisterInfo for canister 'idempotent-proxy-canister'.
Caused by: No crate `idempotent-proxy-canister` found`
Downgrading my dfx to 0.22.0 made it work. Now I don’t know how to fix it with dfx 0.23.0
Issue from github:
opened 01:23PM - 25 Sep 24 UTC
Took me a while to find out the reason while my build fails with the error:
`… ``
$ dfx build idempotent-proxy-canister
Building canisters...
Checking for vulnerabilities in rust canisters.
Fetching advisory database from https://github.com/RustSec/advisory-db.git
Loaded 660 security advisories (from /home/tanguy/.cargo/advisory-db)
Updating crates.io index
Scanning Cargo.lock for vulnerabilities (308 crate dependencies)
Audit found no vulnerabilities.
Error: Failed while trying to build all canisters.
Caused by: The build step failed for canister 'bkyz2-fmaaa-aaaaa-qaaaq-cai' (idempotent-proxy-canister)
Caused by: Failed to build Rust canister 'idempotent-proxy-canister'.
Caused by: Failed to create <Type>CanisterInfo for canister 'idempotent-proxy-canister'.
Caused by: No crate `idempotent-proxy-canister` found`
```
Downgrading my dfx to 0.22.0 made it work. Now I don't know how to fix it with dfx 0.23.0
zensh
September 25, 2024, 4:10pm
2
I can reproduce the issue but haven’t found the cause.
wiyota
September 25, 2024, 5:20pm
3
dfx v0.23 cannot handle Rust canisters with hyphens in the crate name.
Try changing name
in Cargo.toml and package
in dfx.json to idempotent_proxy_canister
.
1 Like
wiyota
September 25, 2024, 5:52pm
4
opened 10:58PM - 16 Sep 24 UTC
needs-triage
Although there aren't any breaking changes, when upgrading from 0.22.0 to 0.23.0… my project is no longer able to build:
```
Error: Failed while trying to build all canisters.
Caused by: The build step failed for canister 'bkyz2-fmaaa-aaaaa-qaaaq-cai' (zk-rust-vue-demo-backend)
Caused by: Failed to build Rust canister 'zk-rust-vue-demo-backend'.
Caused by: Failed to create <Type>CanisterInfo for canister 'zk-rust-vue-demo-backend'.
Caused by: No crate `zk-rust-vue-demo-backend` found
```
Here is my DFX file:
```
{
"canisters": {
"internet-identity": {
"type": "pull",
"id": "rdmx6-jaaaa-aaaaa-aaadq-cai"
},
"zk-rust-vue-demo-backend": {
"dependencies": [
"internet-identity"
],
"candid": "src/zk-rust-vue-demo-backend/zk-rust-vue-demo-backend.did",
"package": "zk-rust-vue-demo-backend",
"type": "rust"
},
"zk-rust-vue-demo-frontend": {
"dependencies": [
"zk-rust-vue-demo-backend"
],
"source": [
"src/zk-rust-vue-demo-frontend/dist"
],
"type": "assets",
"workspace": "zk-rust-vue-demo-frontend"
}
},
"defaults": {
"build": {
"args": "",
"packtool": ""
}
},
"output_env_file": ".env",
"version": 1
}
```
### Meta
`dfx --version`:
```
0.22.0 upgrading to 0.23.0
```
<!--
If possible, please add log output using the --verbose flag.
This will make debugging a lot easier.
-->
<details><summary>Further log output</summary>
<p>
```
Building canisters...
Checking for vulnerabilities in rust canisters.
Fetching advisory database from `https://github.com/RustSec/advisory-db.git`
Loaded 659 security advisories (from /home/kairus/.cargo/advisory-db)
Updating crates.io index
Scanning Cargo.lock for vulnerabilities (79 crate dependencies)
Audit found no vulnerabilities.
Building frontend...
Running cd "/mnt/c/Users/Kairus/git/IC/zk-rust-vue-demo" && CANISTER_CANDID_PATH="/mnt/c/Users/Kairus/git/IC/zk-rust-vue-demo/.dfx/local/canisters/zk-rust-vue-demo-frontend/assetstorage.did" CANISTER_ID="bd3sg-teaaa-aaaaa-qaaba-cai" CANISTER_ID_INTERNET_IDENTITY="rdmx6-jaaaa-aaaaa-aaadq-cai" CANISTER_ID_ZK_RUST_VUE_DEMO_BACKEND="bkyz2-fmaaa-aaaaa-qaaaq-cai" CANISTER_ID_ZK_RUST_VUE_DEMO_FRONTEND="bd3sg-teaaa-aaaaa-qaaba-cai" DFX_NETWORK="local" DFX_VERSION="0.23.0" "npm" "run" "build" "--workspace" "zk-rust-vue-demo-frontend"...
WARN: Generating type declarations for canister zk-rust-vue-demo-frontend:
/mnt/c/Users/Kairus/git/IC/zk-rust-vue-demo/src/declarations/zk-rust-vue-demo-frontend/zk-rust-vue-demo-frontend.did.d.ts
/mnt/c/Users/Kairus/git/IC/zk-rust-vue-demo/src/declarations/zk-rust-vue-demo-frontend/zk-rust-vue-demo-frontend.did.js
/mnt/c/Users/Kairus/git/IC/zk-rust-vue-demo/src/declarations/zk-rust-vue-demo-frontend/zk-rust-vue-demo-frontend.did
Generating type declarations for canister zk-rust-vue-demo-backend:
/mnt/c/Users/Kairus/git/IC/zk-rust-vue-demo/src/declarations/zk-rust-vue-demo-backend/zk-rust-vue-demo-backend.did.d.ts
/mnt/c/Users/Kairus/git/IC/zk-rust-vue-demo/src/declarations/zk-rust-vue-demo-backend/zk-rust-vue-demo-backend.did.js
/mnt/c/Users/Kairus/git/IC/zk-rust-vue-demo/src/declarations/zk-rust-vue-demo-backend/zk-rust-vue-demo-backend.did
Generating type declarations for canister internet-identity:
/mnt/c/Users/Kairus/git/IC/zk-rust-vue-demo/src/declarations/internet-identity/internet-identity.did.d.ts
/mnt/c/Users/Kairus/git/IC/zk-rust-vue-demo/src/declarations/internet-identity/internet-identity.did.js
/mnt/c/Users/Kairus/git/IC/zk-rust-vue-demo/src/declarations/internet-identity/internet-identity.did
Error: Failed while trying to build all canisters.
Caused by: The build step failed for canister 'bkyz2-fmaaa-aaaaa-qaaaq-cai' (zk-rust-vue-demo-backend)
Caused by: Failed to build Rust canister 'zk-rust-vue-demo-backend'.
Caused by: Failed to create <Type>CanisterInfo for canister 'zk-rust-vue-demo-backend'.
Caused by: No crate `zk-rust-vue-demo-backend` found
```
</p>
</details>
I found a similar issue here, so I have commented on it, including the part that I think might be the cause.
AdamS
September 25, 2024, 10:52pm
5
dfx can handle hyphens in the package name, but it assumes the wrong crate name. For a stopgap, you do not need to change your Cargo package names, you just need to use dfx’s new field for the crate name.
"package": "idempotent-proxy-canister",
"crate": "idempotent_proxy_canister",
This regression will be fixed in the next release.
3 Likes
AdamS
October 7, 2024, 1:10pm
6
As of 0.24 hyphens are correctly handled.
4 Likes