Trying to upload to my front end Canister and it’s erroring, I’ve added the controller. It still doesn’t work:
Error: The Replica returned an error: code 4, message: "Caller is not authorized"
Trying to upload to my front end Canister and it’s erroring, I’ve added the controller. It still doesn’t work:
Error: The Replica returned an error: code 4, message: "Caller is not authorized"
Are you sure you are using the right identity ?
dfx identity get-principal
The certified asset canister keeps its own state of authorized principles independent of the controllers of the actual canister.
Initially only the principal that installed the certified asset canister is in this list of authorized principals.
Did you upgrade dfx recently? You may have a conflict between a canister that was proxied through a cycles wallet, and making the call directly from your dfx identity.
Try this command to auto-fix those settings for your project:
dfx canister --wallet "$(dfx identity --network ic get-wallet)" --network ic update-settings --all --add-controller "$(dfx identity get-principal)"```
Yeah I tried the following with the return value from dfx identity get-principal
dfx canister --network ic call "dwqte-viaaa-aaaai-qaufq-cai" authorize '(principal "...")'
Still getting the same error. On deploy
Okay, if that’s erroring it’s probably because the owner is already authorized. What exact command are you using to deploy, and what version of dfx
are you using?
dfx: 0.10.0
command is dfx deploy --network ic --no-wallet
here’s the dfx.json
{
"canisters": {
"feedback": {
"main": "src/backend/feedback.mo",
"type": "motoko"
},
"dsocial": {
"main": "src/backend/main.mo",
"type": "motoko"
},
"frontend" : {
"dependencies": ["dsocial", "feedback"],
"frontend": {
"entrypoint": "build/index.html"
},
"source": [
"build"
],
"type": "assets"
}
},
"defaults": {
"build": {
"output": "canisters",
"packtool": ""
}
},
"networks": {
"local": {
"bind": "127.0.0.1:8000",
"type": "ephemeral"
}
},
"version": 1
}
Thanks for your help, here to do anything to get this resolved. Lots of code to deploy!!
Try removing --no-wallet
. It’s deprecated in 0.10.0, although I notice it still shows up in the help command
This is a bit scary TBH, from what I can see I have to setup a new wallet? But I already have an NNS account linked to an Internet Identity that owns all the canisters for DSocial. Can I not use this account already with a ton of ICP and setup?
Would be cool if you could just dfx login
and it would auth you with your NNS account and just work out the box. Feels like I could easily make a mistake here.
I’m probably not understanding how to do this, I simply want to deploy to my current canisters. Backend canisters work no problem, it is just this front canister that is not working.
Oh wait, this isn’t a matter of controllers at all. This is about uploads after the fact.
You can either reinstall the asset canister with
dfx build
dfx canister install <asset-canister> --mode reinstall
or you need to call the authorize
method on your canister with your
current ID. Your identity is a controller, but it is not authorized to upload assets, for some convoluted reason.
Thanks Kyle - will this allow reinstall the dep canisters or just the frontend canister? Forgive my fear, just don’t want to lose all previous state
specifying the name of the asset canister for dfx install
will only affect the named canister.
We also have protection against running dfx install
with --mode reinstall
for all canisters. It is only allowed while targeting a single canister
Fixed, paid subscriptions is now LIVE!