sdk icon indicating copy to clipboard operation
sdk copied to clipboard

`dfx deploy --network=ic` failure on a newly created project

Open ninegua opened this issue 1 year ago • 5 comments

I tried the following:

  1. dfx new --frontend vanilla hello
  2. dfx deploy --network=ic

I expected it to successfully deploy both backend and frontend canisters.

Instead, this happened:

WARN: The default identity is not stored securely. Do not use it to control a lot of cycles/ICP. Create a new identity with `dfx identity new` and use it in mainnet-facing comm
ands with the `--identity` flag
Deploying all canisters.
Creating canisters...
Creating canister hello_backend...
hello_backend canister created on network ic with canister id: mnqht-aaaaa-aaaal-qjpaq-cai
Creating canister hello_frontend...
hello_frontend canister created on network ic with canister id: metmp-wiaaa-aaaal-qjpba-cai
Building canisters...
Building frontend...
Error: Failed while trying to deploy canisters.
Caused by: Failed to build all canisters.
Caused by: Failed while trying to build all canisters.
Caused by: The post-build step failed for canister 'metmp-wiaaa-aaaal-qjpba-cai' (hello_frontend)
Caused by: Failed to build frontend for network 'ic'.
Caused by: The command 'cd "/Users/paul/hello" && CANISTER_CANDID_PATH="/Users/paul/hello/.dfx/ic/canisters/hello_frontend/assetstorage.did" CANISTER_CANDID_PATH_HELLO_BACKEND=
"/Users/paul/hello/.dfx/ic/canisters/hello_backend/hello_backend.did" CANISTER_ID="metmp-wiaaa-aaaal-qjpba-cai" CANISTER_ID_HELLO_BACKEND="mnqht-aaaaa-aaaal-qjpaq-cai" CANISTER
_ID_HELLO_FRONTEND="metmp-wiaaa-aaaal-qjpba-cai" DFX_NETWORK="ic" DFX_VERSION="0.22.0" NODE_ENV="production" "npm" "run" "build" "--workspace" "hello_frontend"' failed with exi
t status 'exit status: 1'.
Stdout:

> [email protected] prebuild
> dfx generate


Stderr:
Building canisters before generate for Motoko
WARN: .did file for canister 'hello_frontend' does not exist.
Generating type declarations for canister hello_frontend:
Error: Failed while trying to generate type declarations for 'hello_frontend'.
Caused by: Candid file: /Users/paul/hello/.dfx/local/canisters/hello_frontend/assetstorage.did doesn't exist.
npm ERR! Lifecycle script `build` failed with error:
npm ERR! Error: command failed
npm ERR!   in workspace: [email protected]
npm ERR!   at location: /Users/paul/hello/src/hello_frontend

Meta

dfx --version:

dfx 0.22.0

ninegua avatar Aug 10 '24 04:08 ninegua

It looks like dfx was looking for a did file from local build

Candid file: /Users/paul/hello/.dfx/local/canisters/hello_frontend/assetstorage.did doesn't exist.

If I start replica and deploy locally first, then deploy to ic works as expected.

ninegua avatar Aug 10 '24 04:08 ninegua

We're running into this when trying to deploy to mainnet too. As part of our deployment step, I'm spinning up and running a local deploy first to generate the files, before doing a --ic deploy

KereyWatters avatar Sep 16 '24 22:09 KereyWatters

Hello,

but this looks like a workaround...

I have the same problem but with deploying to the playground. It's looking for a did file from the local build, not from the 'playground' (or 'ic' in your case) folder where all files are.

alisovoy avatar Nov 22 '24 10:11 alisovoy

Apparently, the issue is fixed here: https://github.com/dfinity/sdk/pull/3987 The version 0.24.2 works as expected (tested only with playground)

alisovoy avatar Nov 22 '24 13:11 alisovoy

Man, these types of errors should be fixed and tested for. These small confusing bugs make development a lot slower and tedious. Imagine a new guy running into this when finding out about IC. They are not coming back.

Anyway, I have this error when deploying to the local network using 0.24.2 and also 0.20.1

Fixed by downloading the assetstorage.did before running dfx build.

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

vincentes avatar Nov 29 '24 19:11 vincentes