dfinity / sdk

IC SDK: a Software Development Kit for creating and managing canister smart contracts on the ICP blockchain.
https://internetcomputer.org/developers
Apache License 2.0
173 stars 84 forks source link

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

Open ninegua opened 2 months ago

ninegua commented 2 months ago

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:

> hello_frontend@0.0.0 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: hello_frontend@0.0.0
npm ERR!   at location: /Users/paul/hello/src/hello_frontend

Meta

dfx --version:

dfx 0.22.0
ninegua commented 2 months ago

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.

KereyWatters commented 1 month ago

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