-
-
Save Aimeedeer/aae0d6759fb04bb30478cbf38d4d46ce to your computer and use it in GitHub Desktop.
$ dfx new firsttest | |
The DFINITY Canister SDK sends anonymous usage data to DFINITY Stiftung by | |
default. If you wish to disable this behavior, then please set the environment | |
variable DFX_TELEMETRY_DISABLED=1. Learn more at https://sdk.dfinity.org. | |
Fetching manifest https://sdk.dfinity.org/manifest.json | |
⠋ Checking for latest dfx version... | |
You seem to be running an outdated version of dfx. | |
You are strongly encouraged to upgrade by running 'dfx upgrade'! | |
Version v0.6.20 installed successfully. | |
Creating new project "firsttest"... | |
CREATE firsttest/src/firsttest_assets/assets/sample-asset.txt (24B)... | |
CREATE firsttest/src/firsttest/main.mo (107B)... | |
CREATE firsttest/dfx.json (484B)... | |
CREATE firsttest/.gitignore (165B)... | |
⠐ Checking for latest dfx version... | |
CREATE firsttest/src/firsttest_assets/public/index.js (149B)... | |
CREATE firsttest/package.json (288B)... | |
CREATE firsttest/webpack.config.js (2.15KB)... | |
⠉ Checking for latest dfx version... | |
⠒ Checking for latest dfx version... | |
⠠ Installing node dependencies... | |
⠤ Checking for latest dfx version... | |
⠖ Installing node dependencies... | |
> fsevents@1.2.13 install /Users/aimeez/github/dfinity-project/firsttest/node_modules/watchpack-chokidar2/node_modules/fsevents | |
> node install.js | |
⠤ Checking for latest dfx version... | |
⠖ Checking for latest dfx version... | |
⠒ Checking for latest dfx version... | |
⠁ Checking for latest dfx version... | |
npm WARN firsttest_assets@0.1.0 No repository field. | |
npm WARN firsttest_assets@0.1.0 No license field. | |
⠙ Checking for latest dfx version... | |
13 packages are looking for funding | |
run `npm fund` for details | |
found 1 high severity vulnerability | |
⠒ Checking for latest dfx version... | |
⠂ Checking for latest dfx version... | |
=============================================================================== | |
Welcome to the internet computer developer community! | |
You're using dfx 0.6.20 | |
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ | |
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ | |
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ | |
▄▄▄▄▄▄▄▄▄▄▀▀▀▀▀▄▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄▄▀▀▀▀▀▀▄▄▄▄▄▄▄▄▄▄ | |
▄▄▄▄▄▄▄▄▀ ▀▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▀ ▀▄▄▄▄▄▄▄▄▄ | |
▄▄▄▄▄▄▄▄▀ ▀▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▀ ▄▄▄▄▄▄▄▄ | |
▄▄▄▄▄▄▄▄ ▀▄▄▄▄▄▄▄▄▄▄▄▄▀ ▄▄▄▄▄▄▄ | |
▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄ | |
▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄ | |
▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▀ | |
▀▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄▄▀ ▀▄▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ | |
▀▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▀ ▀▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▀ | |
▀▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▀ ▀▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ | |
▀▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▀▀ ▀▀▄▄▄▄▄▄▄▄▄▄▄▄▄▄▀ | |
▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀ | |
To learn more before you start coding, see the documentation available online: | |
- Quick Start: https://sdk.dfinity.org/docs/quickstart/quickstart-intro.html | |
- SDK Developer Tools: https://sdk.dfinity.org/docs/developers-guide/sdk-guide.html | |
- Motoko Language Guide: https://sdk.dfinity.org/docs/language-guide/motoko.html | |
- Motoko Quick Reference: https://sdk.dfinity.org/docs/language-guide/language-manual.html | |
If you want to work on programs right away, try the following commands to get started: | |
cd firsttest | |
dfx help | |
dfx new --help | |
=============================================================================== | |
Aimeedeer
commented
Jan 25, 2021
Call succeed:
$ dfx canister --network=ic call hello greet everyone
("Hello, everyone!")
Check balance failed:
$ dfx canister --network=ic call xibue-hiaaa-aaaaa-qabza-cai cycle_balance
The Replica returned an error: code 3, message: "Canister xibue-hiaaa-aaaaa-qabza-cai has no update method 'cycle_balance'"
$ dfx canister --network=ic call xpasq-kqaaa-aaaaa-qabzq-cai cycle_balance
The Replica returned an error: code 3, message: "Canister xpasq-kqaaa-aaaaa-qabzq-cai has no update method 'cycle_balance'"
Try to call method by id (instead of "hello"):
$ dfx canister --network=ic call xibue-hiaaa-aaaaa-qabza-cai greet everyone
error: parser error
┌─ Candid argument:1:1
│
1 │ everyone
│ ^^^^^^^^ Unexpected token
│
= Expects "("
Invalid argument: Invalid Candid values: Candid parser error: Unrecognized token `Id("everyone")` found at 0:8
Expected one of "("
Try to check balance with the name "hello" (instead of its id):
$ dfx canister --network=ic call hello cycle_balance
The Replica returned an error: code 3, message: "Canister xibue-hiaaa-aaaaa-qabza-cai has no update method 'cycle_balance'"
Deploy locally and run the call balance command again:
$ dfx deploy
Deploying all canisters.
All canisters have already been created.
Building canisters...
Building frontend...
Installing canisters...
Installing code for canister hello, with canister_id rwlgt-iiaaa-aaaaa-aaaaa-cai
Installing code for canister hello_assets, with canister_id rrkah-fqaaa-aaaaa-aaaaq-cai
Deployed canisters.
$ dfx canister call rwlgt-iiaaa-aaaaa-aaaaa-cai cycle_balance
The Replica returned an error: code 3, message: "Canister rwlgt-iiaaa-aaaaa-aaaaa-cai has no update method 'cycle_balance'"
$ dfx canister call rrkah-fqaaa-aaaaa-aaaaq-cai cycle_balance
The Replica returned an error: code 3, message: "Canister rrkah-fqaaa-aaaaa-aaaaq-cai has no update method 'cycle_balance'"
Encounter new error when I follow this section:
https://sdk.dfinity.org/docs/quickstart/network-quickstart.html#quickstart-frontend
My URL is: https://xibue-hiaaa-aaaaa-qabza-cai.ic0.app/
The page shows (Firefox):
An error happened:
v/<@https://xibue-hiaaa-aaaaa-qabza-cai.ic0.app/bootstrap-0e838d0d6297858d1bfe.js:2:43879
The error on Brave:
An error happened:
Error: Query failed:
Status: rejected
Message: IC0302: Canister xibue-hiaaa-aaaaa-qabza-cai has no query method 'retrieve'
at r.retrieve (https://xibue-hiaaa-aaaaa-qabza-cai.ic0.app/bootstrap-0e838d0d6297858d1bfe.js:2:43879)
at async _loadJs (https://xibue-hiaaa-aaaaa-qabza-cai.ic0.app/bootstrap-0e838d0d6297858d1bfe.js:2:245656)
at async _main (https://xibue-hiaaa-aaaaa-qabza-cai.ic0.app/bootstrap-0e838d0d6297858d1bfe.js:2:246619)
Follow the doc: Create a new project
$ dfx deploy
Deploying all canisters.
All canisters have already been created.
Building canisters...
Building frontend...
Installing canisters...
Installing code for canister contacts, with canister_id ryjl3-tyaaa-aaaaa-aaaba-cai
replica error. attempting install
Installing code for canister contacts, with canister_id ryjl3-tyaaa-aaaaa-aaaba-cai
Installing code for canister contacts_assets, with canister_id r7inp-6aaaa-aaaaa-aaabq-cai
replica error. attempting install
Installing code for canister contacts_assets, with canister_id r7inp-6aaaa-aaaaa-aaabq-cai
Deployed canisters.
Deploy on IC:
$ dfx deploy --network ic
Deploying all canisters.
Creating canisters...
Creating canister "contacts"...
The replica returned an HTTP Error: Http Error: status 504 Gateway Timeout, content type "text/html", content: [60, 104, 116, 109, 108, 62, 13, 10, 60, 104, 101, 97, 100, 62, 60, 116, 105, 116, 108, 101, 62, 53, 48, 52, 32, 71, 97, 116, 101, 119, 97, 121, 32, 84, 105, 109, 101, 45, 111, 117, 116, 60, 47, 116, 105, 116, 108, 101, 62, 60, 47, 104, 101, 97, 100, 62, 13, 10, 60, 98, 111, 100, 121, 62, 13, 10, 60, 99, 101, 110, 116, 101, 114, 62, 60, 104, 49, 62, 53, 48, 52, 32, 71, 97, 116, 101, 119, 97, 121, 32, 84, 105, 109, 101, 45, 111, 117, 116, 60, 47, 104, 49, 62, 60, 47, 99, 101, 110, 116, 101, 114, 62, 13, 10, 60, 104, 114, 62, 60, 99, 101, 110, 116, 101, 114, 62, 110, 103, 105, 110, 120, 47, 49, 46, 49, 56, 46, 48, 32, 40, 85, 98, 117, 110, 116, 117, 41, 60, 47, 99, 101, 110, 116, 101, 114, 62, 13, 10, 60, 47, 98, 111, 100, 121, 62, 13, 10, 60, 47, 104, 116, 109, 108, 62, 13, 10]
Deploy on IC second try:
$ dfx deploy --network ic
Deploying all canisters.
Creating canisters...
Creating canister "contacts"...
"contacts" canister created on network "ic" with canister id: "wxjht-eqaaa-aaaaa-qab5q-cai"
Creating canister "contacts_assets"...
"contacts_assets" canister created on network "ic" with canister id: "5jw7w-wiaaa-aaaab-qacza-cai"
Building canisters...
Building frontend...
Installing canisters...
Installing code for canister contacts, with canister_id wxjht-eqaaa-aaaaa-qab5q-cai
Installing code for canister contacts_assets, with canister_id 5jw7w-wiaaa-aaaab-qacza-cai
Deployed canisters.
Visit with URL: http://127.0.0.1:8000/?canisterId=ryjl3-tyaaa-aaaaa-aaaba-cai
Error on Firefox:
An error happened:
_/<@http://127.0.0.1:8000/bootstrap-70b8f66975aa20b1974d.js:2:47697
Error on Brave:
An error happened:
Error: Query failed:
Status: rejected
Message: IC0302: Canister ryjl3-tyaaa-aaaaa-aaaba-cai has no query method 'retrieve'
at r.retrieve (http://127.0.0.1:8000/bootstrap-70b8f66975aa20b1974d.js:2:47697)
at async _loadJs (http://127.0.0.1:8000/bootstrap-70b8f66975aa20b1974d.js:2:524963)
at async _main (http://127.0.0.1:8000/bootstrap-70b8f66975aa20b1974d.js:2:525927)
Error in terminal:
Jan 25 19:09:52.603 WARN s:fscpm-uiaaa-aaaaa-aaaap-yai/n:2p24q-qnsu5-x2nux-fddu3-hovpm-knd7o-6wnmb-qwfc2-pv5nb-7tjeo-dqe/ic_http_handler/read Could not perform query on canister: IC0302: Canister ryjl3-tyaaa-aaaaa-aaaba-cai has no query method 'retrieve'
I found out that I used the wrong id for visiting from browsers. I should use contacts_assets's canister_id r7inp-6aaaa-aaaaa-aaabq-cai instead of contacts's canister_id ryjl3-tyaaa-aaaaa-aaaba-cai. It works with URL:
http://127.0.0.1:8000/?canisterId=r7inp-6aaaa-aaaaa-aaabq-cai
Deploy the example program Contacts on IC:
$ dfx deploy --network=ic
Deploying all canisters.
All canisters have already been created.
Building canisters...
Building frontend...
Installing canisters...
Installing code for canister contacts, with canister_id wxjht-eqaaa-aaaaa-qab5q-cai
Installing code for canister contacts_assets, with canister_id 5jw7w-wiaaa-aaaab-qacza-cai
Uploading assets to asset canister...
Deployed canisters.
The url is: https://5jw7w-wiaaa-aaaab-qacza-cai.ic0.app/