-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error while importing a canister #282
Comments
Hi, thanks for reaching out! I am trying to reproduce the issue, but everything seems to work as expected on my end. Would you be able to send the relevant part of your |
@rvanasa Here's my dfx.json file:
|
Which OS are you using? I tested on both macOS M1 and Ubuntu, and everything seems to work for me. Are you also using the latest version of dfx ( It might be possible to temporarily work around this using the "icp_ledger_canister": {
"type": "custom",
"candid": "https://github.com/raw/dfinity/ic/ec35ebd252d4ffb151d2cfceba3a86c4fb87c6d6/rs/rosetta-api/icp_ledger/ledger.did",
"wasm": "https://download.dfinity.systems/ic/ec35ebd252d4ffb151d2cfceba3a86c4fb87c6d6/canisters/ledger-canister.wasm.gz",
"specified_id": "ryjl3-tyaaa-aaaaa-aaaba-cai",
"remote": {
"id": {
"ic": "ryjl3-tyaaa-aaaaa-aaaba-cai"
}
}
} Then, you could potentially use the approach described in this forum reply. |
@rvanasa thanks I realized that I had
seems pretty normal to me, but maybe this could be causing the issue ? So I first ran the above command, then later only used |
I've followed the same steps on both of my testing environments and still haven't managed to reproduce the issue. Does anything look unusual in the "Motoko Language Server" extension logs? For reference, here is where to find it: ![]() Do you encounter the same issue when opening the project on an online IDE such as Gitpod? This might help narrow down the possibilities. Starter project which you can replace with your own files: Alternatively, do you have a public Git repository for your project? |
I have no errors displayed in my VSCode "Output" tab (Motoko Language Server selected). The repository is private but I just added you @rvanasa. |
Thanks for adding me to the repository! I was able to reproduce the issue by running the following commands in a Gitpod environment: sh -ci "$(curl -fsSL https://internetcomputer.org/install.sh)"
source "$HOME/.local/share/dfx/env"
dfx start --background
export MINTER_ACCOUNT_ID=$(dfx ledger account-id)
export DEFAULT_ACCOUNT_ID=$(dfx ledger account-id)
dfx deploy --specified-id ryjl3-tyaaa-aaaaa-aaaba-cai icp_ledger_canister --argument "
(variant {
Init = record {
minting_account = \"$MINTER_ACCOUNT_ID\";
initial_values = vec {
record {
\"$DEFAULT_ACCOUNT_ID\";
record {
e8s = 10_000_000_000 : nat64;
};
};
};
send_whitelist = vec {};
transfer_fee = opt record {
e8s = 10_000 : nat64;
};
token_symbol = opt \"LICP\";
token_name = opt \"Local ICP\";
}
})
" Instead of Is this the same for you? If so, you can fix the issue by resetting your local dfx environment ( This appears to be some sort of platform-specific bug, since it doesn't happen on my local dev environment for some reason. I will see if there is a way to fix this in the extension. Hopefully removing the |
@rvanasa actually no, I'm still getting the same isssue in Gitpod as I was locally: |
That being said, I don't really know how Gitpod works: I basically just authorized access to my repo and it initialized itself. I didn't run any commands. |
Got it; this error message will always show up until all canisters are deployed. Does everything work if you run the commands that I listed above? |
@rvanasa Ok, so after running your command, I see no more error! |
Since this seems to narrow down the issue to something that's specific to your local dev environment, here are a few more debugging questions:
|
@rvanasa
then By the way, my Mac has an M2. However I'm not using Rosetta (at least not to my knowledge!) |
Yep! As a side note, if you want to simplify the setup process, you can add the "icp_ledger_canister": {
"type": "custom",
"candid": "https://github.com/raw/dfinity/ic/ec35ebd252d4ffb151d2cfceba3a86c4fb87c6d6/rs/rosetta-api/icp_ledger/ledger.did",
"wasm": "https://download.dfinity.systems/ic/ec35ebd252d4ffb151d2cfceba3a86c4fb87c6d6/canisters/ledger-canister.wasm.gz",
"remote": {
"id": {
"ic": "ryjl3-tyaaa-aaaaa-aaaba-cai"
}
},
"init_arg_file": "candid/icp_ledger_init.did"
}, Then, create a new
It might be worth debugging this VS Code issue first, but I just wanted to mention this since it's a nice quality-of-life improvement that was recently added to dfx. |
@rvanasa I successfully restarted everything (I even restarted my laptop, as I don't do it often enough and sometimes get cache issues.. :P ), then started VSCode from a terminal where dfx 0.20.1 is available, then:
Everything works, but I still get the error "canister alias icp_ledger_canister is not defined..." 🤯 Sorry, I feel like I'm taking too much of your time! Any other idea? How are the aliases defined (in the dfx.json file, right? then why..) ? And why am I not seeing the error in Gitpod.. 😟 I noticed in the forum 2 guys having the same issue 2 years ago. Just like him, I really wouldn't want to have to create a class just to use the icp ledger canister. |
No worries; it would be good to figure out what's happening so that we can fix this for anyone else encountering the same issue. This is bizarre though. I'll ask around internally to see if we can further narrow down the root cause. |
As a quick update, I included a bugfix in version You could try the new logic by adjusting your
I also added some additional debugging info in the output panel (specifically the "Actor alias" output) which could be useful if the extension still isn't working as expected on your local machine. |
Hey @rvanasa, thanks! I just saw your message. So, after upgrading to
I'm still getting the exact same error.. sigh
Also, note that I don't see anything in the "Output" tab. Thanks again for sticking with me :) |
Thanks for the debugging info. Since this only seems to happen on your machine (given that everything works on Gitpod and #284 fixed the error for Severin internally), I'm not sure if there's much else I can do to figure out what's causing this. If anyone else comes across this page with a similar issue, please be sure to leave a comment so we can more effectively triangulate what's happening. |
Issue:
Canister import is shown as an error whereas it shouldn't:
![image](https://private-user-images.githubusercontent.com/169675383/335830066-4d2f4388-9834-4c2b-9a9d-cae6f0d7aab8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQyOTExOTQsIm5iZiI6MTcyNDI5MDg5NCwicGF0aCI6Ii8xNjk2NzUzODMvMzM1ODMwMDY2LTRkMmY0Mzg4LTk4MzQtNGMyYi05YTlkLWNhZTZmMGQ3YWFiOC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODIyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgyMlQwMTQxMzRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1mOTA0YmUxYTQ1NWY3OTljYTlkOTRlZmYwOGNjYzAxNGZiYzBhMTM1M2NlNmI0N2QxZmRhZjNiNzAwNTkyNzg0JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.BEjlvd467VUv854wmX6_ZgGG-d-s4VRfh6pBX_4-fjM)
How to reproduce:
I'm trying to use the ICP ledger from my backend canister. For that I'm doing 2 things:
N.B: the VSCode extension error message says:
..however
dfx deploy
runs successfully while the file still complains about an error on the import.Related forum issue:
https://forum.dfinity.org/t/canister-dependency-not-working/31377
The text was updated successfully, but these errors were encountered: