Hello, i am new in IC Network, and i want to understand why I am not able to deploy locally a project if I set a new Internet Identity with Dfx identity new cmd with passphrase encryption. When I test to deploy the simple hello dapp I can deploy only if i use the default Dfx identity with no encryption or if i create one with --disable-encryption option, otherwise i am stuck at the dfx build phase like this :
$ dfx deploy
Please enter the passphrase for your identity: [hidden]
Decryption complete.
Creating a wallet canister on the local network.
The wallet canister on the ālocalā network for user āic_yangshueiā is ārkp4c-7iaaa-aaaaa-aaaca-caiā
Deploying all canisters.
Creating canistersā¦
Creating canister hello_backendā¦
hello_backend canister created with canister id: rno2w-sqaaa-aaaaa-aaacq-cai
Creating canister hello_frontendā¦
hello_frontend canister created with canister id: renrk-eyaaa-aaaaa-aaada-cai
Building canistersā¦
Shrink WASM module size.
Building frontendā¦
No error message either so I wasnāt able to figure it out where is the issue.
The build step does not access your identity in any way, so would guess that the problem lies somewhere else. Since the frontend build hangs: Is there a chance you have a problem with node/npm? We generally recommend that you use Node version 16.
yea itās really strange, I am using already Node 16, I try again with dfx start --clean to clean up and redeploy I still got the same issue and stuck at the building phase, however if I try to redeploy with a new identity without encryption it work fine.
I looked at the code once more, and thereās really no way for the identity to influence anything once Creating a wallet appears. Can you try nuking everything generated in the project?
well after nuking everthing, I even uninstall and reinstall a clean version of dfx (0.12.0) with the cmd line in the doc it still doesnāt work, I also think the issue is somewhere else.
Oh sry, yea I already reinstall node, I even try node 18 and 19 but still the same issueā¦ but itās not really a big deal for now as I can still work with it and play around, itās just a weird issue thatās why I am asking, and sry for taking your time >.>
Hi! I also have the same problem. What I did is to really stick with the ādefaultā identity. If you have problems while deploying the canister. I suggest to use ādfx canister update-settingsā to add a default controller (āadd-controller ) then set it to the default controller (āset-controller ). Make sure to use the āāallā arguments so you donāt repeat yourself. Try deploying it again it should work.
Iām having the same issue. However, I had already used different identities before and never encountered this issue. Now, after having created a new identity, building the frontend canister stops without an error message. Deleting .dfx and node_modules didnāt help either. Any solution to this other than using the default identity?
@dindog18, @karim, does this also happen to you if you use the default dfx new project? Or is it something bigger? I canāt reproduce this on my machine, so any information would be very helpful
I just double-checked and tried deploying a new default project. Same issue here, but again only on mainnet. dfx deploy on the local replica does work. dfx version is 0.12.1. If the issue was related to insufficient cycles, would dfx tell me so?
Yes, you would see an error message that talks about cycles. Most likely it would say insufficient cycles.
Just tried the same, and it worked. Can you maybe try dfx deploy with the flag -vv? This would enable debugging output and maybe would include some relevant information.
I did some more testing. The issue arises with newly created identities both when trying to deploy locally and on mainnet, but only in certain projects including new default projects created with dfx new. Apparently, itās hanging at npm run build. This is a new default project created with dfx new:
[karim@archlvm test]$ dfx deploy -vv
Trace mode enabled. Lots of logs coming up.
Please enter the passphrase for your identity: [hidden]
Decryption complete.
Deploying all canisters.
All canisters have already been created.
Building canisters...
No canister of type 'rust' found. Not trying to run 'cargo audit'.
Building canister 'test_backend'.
Running "/home/karim/.cache/dfinity/versions/0.12.1/moc" "/home/karim/test/src/test_backend/main.mo" "-o" "/home/karim/test/.dfx/local/canisters/test_backend/test_backend.wasm" "-c" "--debug" "--idl" "--stable-types" "--public-metadata" "candid:service" "--actor-idl" "/home/karim/test/.dfx/local/canisters/idl/" "--actor-alias" "test_backend" "rrkah-fqaaa-aaaaa-aaaaq-cai" "--actor-alias" "test_frontend" "ryjl3-tyaaa-aaaaa-aaaba-cai" "--package" "base" "/home/karim/.cache/dfinity/versions/0.12.1/base"...
Shrink WASM module size.
Building canister 'test_frontend'.
Building frontend...
Running "npm" "run" "build"...
Iām getting this warning when creating a new default project:
[karim@archlvm test]$ npm run build --progress
> test_frontend@0.1.0 prebuild
> npm run generate
> test_frontend@0.1.0 generate
> dfx generate test_backend
Please enter the passphrase for your identity: [hidden]
Decryption complete.
Building canisters before generate for Motoko
Shrink WASM module size.
Generating type declarations for canister test_backend:
src/declarations/test_backend/test_backend.did.d.ts
src/declarations/test_backend/test_backend.did.js
src/declarations/test_backend/test_backend.did
> test_frontend@0.1.0 build
> webpack
No production canister_ids.json found. Continuing with local
asset index.js 622 KiB [emitted] (name: index) 1 related asset
asset index.html 689 bytes [emitted]
runtime modules 1.16 KiB 6 modules
modules by path ./node_modules/@dfinity/ 234 KiB 38 modules
modules by path ./node_modules/borc/ 113 KiB
./node_modules/borc/src/index.js 647 bytes [built] [code generated]
+ 9 modules
modules by path ./src/ 1.89 KiB
./src/test_frontend/src/index.js 547 bytes [built] [code generated]
+ 2 modules
modules by path ./node_modules/simple-cbor/src/*.js 17.5 KiB
./node_modules/simple-cbor/src/index.js 595 bytes [built] [code generated]
+ 2 modules
modules by path ./node_modules/iso-url/ 4.36 KiB
./node_modules/iso-url/index.js 285 bytes [built] [code generated]
+ 2 modules
+ 7 modules
webpack 5.75.0 compiled successfully in 953 ms
This means that I can avoid the issue by running npm run build and then dfx canister create test_frontend followed by dfx build test_frontend and dfx canister install test_frontend.
Iāve also tried dfx 0.12.0 but the issue persists. Node version is v17.9.1, npm version is 8.11.0. Btw: Does dfx look for a ārustā canister by default when deploying? Iāve never noticed this line before and I donāt use Rust: No canister of type 'rust' found. Not trying to run 'cargo audit'.
Thank you very much for the thorough investigation, @karim! Can you maybe try once more with a stable node version? v17 is not stable and weāve seen best success with v16 and v18.
Not quite. It looks for any canister of typerust, not a canister that is called rust. If it finds one, it will run cargo audit to notify the developer of vulnerable dependencies.
Iām having this same issue with node 16 and 18 on my mac and linux machines. But, if I try to run dfx build <canister-name> it hangs as well (frontend only, backend builds fine). However, npm run build runs fine by itself if I manually run it.
Itās really just running npm run build on its own (see source code). Can you maybe try once more with -vv to enable debug output? I feel there has to be something else going onā¦
I just heard this may be because npm run build tries to access (for some questionable reason) the identity. Can you test if this only happens if you use a non-plaintext identity? (i.e. a keyring or password-protected one)
wow i thought i was the only one with this weird issue but looks like itās not >.> I also try with a plaintext identity there is still the same issue, and when i run dfx deploy -vv i have more or less the same log as karim, and although getting stuck at the npm run build phase, it looks like the build continues to proceed behind the sceneā¦ because when i run npm start after forcing the exit, it work.