Because you didn’t provide upgrade argument
which means you need to define the environment variables.
Thanks I will look into what this means today and get back to you after a few hours of searching.
@Severin, are their any docs about adding environment variables to the sns quill commands. Is it like passing --ic into the make-upgrade-canister-proposal.
Does my development environment need some variable?
Any documentation on what these environment variables are and why they are not needed to upgrade the backend?
No…
Sorry I think my English was not good.
Try this script! This is what I meant.
You need to add the upgrade argument to set permissions.
If you don’t provide it, the field is processed as None.
#!/bin/bash
echo begin
# Set current directory to the scripts root
SCRIPT=$(readlink -f "$0")
SCRIPT_DIR=$(dirname "$SCRIPT")
cd $SCRIPT_DIR
TITLE="Update Frontend Canister Permissions."
SUMMARY="Update the frontend canister permissions, adding commit permissions for the governance canister."
URL="https://openfpl.xyz"
CANISTER_NAME=OpenFPL_frontend
NETWORK="ic"
# Get the target canister id
TARGET_CANISTER_ID=$(dfx -qq canister --network $NETWORK id $CANISTER_NAME)
dfx identity use ic_admin
OWNER_IDENTITY=$(dfx identity whoami)
PEM_FILE="$(readlink -f "$HOME/.config/dfx/identity/${OWNER_IDENTITY}/identity.pem")"
PROPOSER_NEURON_ID=d2ccf59abe1741c21c35da7e3863d5d14c97d9b82b36045f4a8d4c336864f6dc
UPGRADE_ARG="(opt variant {
Upgrade = record {
set_permissions = opt record {
prepare = vec {
principal \"detjl-sqaaa-aaaaq-aacqa-cai\";
principal \"4jijx-ekel7-4t2kx-32cyf-wzo3t-i4tas-qsq4k-ujnug-oxke7-o5aci-eae\"
};
commit = vec { principal \"detjl-sqaaa-aaaaq-aacqa-cai\"};
manage_permissions = vec { principal \"detjl-sqaaa-aaaaq-aacqa-cai\"}
}
}
})"
echo $UPGRADE_ARG
# Make the proposal using quill
quill sns \
--canister-ids-file ../../utils/sns_canister_ids.json \
--pem-file $PEM_FILE make-upgrade-canister-proposal \
make-upgrade-canister-proposal \
--title "$TITLE" \
--url "$URL" \
--summary "$SUMMARY" \
--target-canister-id $TARGET_CANISTER_ID \
--wasm-path '../../../.dfx/ic/canisters/OpenFPL_frontend/assetstorage.wasm.gz' \
--canister-upgrade-arg "$UPGRADE_ARG"\
$PROPOSER_NEURON_ID > msg.json
quill send msg.json
rm -f msg.json
Thanks @KinicDevContributor for your help.
Just to confirm, this is the code I used to update the frontend by proposal.
I added permission for the governance canister to give it permission to update the frontend canister using this script:
#!/bin/bash
echo begin
# Set current directory to the scripts root
SCRIPT=$(readlink -f "$0")
SCRIPT_DIR=$(dirname "$SCRIPT")
cd $SCRIPT_DIR
TITLE="Update Frontend Canister Permissions."
SUMMARY="Update the frontend canister permissions, adding commit permissions for the governance canister."
URL="https://openfpl.xyz"
CANISTER_NAME=OpenFPL_frontend
NETWORK="ic"
# Get the target canister id
TARGET_CANISTER_ID=$(dfx -qq canister --network $NETWORK id $CANISTER_NAME)
dfx identity use ic_admin
OWNER_IDENTITY=$(dfx identity whoami)
PEM_FILE="$(readlink -f "$HOME/.config/dfx/identity/${OWNER_IDENTITY}/identity.pem")"
PROPOSER_NEURON_ID=d2ccf59abe1741c21c35da7e3863d5d14c97d9b82b36045f4a8d4c336864f6dc
UPGRADE_ARG="(opt variant {
Upgrade = record {
set_permissions = opt record {
prepare = vec {
principal \"detjl-sqaaa-aaaaq-aacqa-cai\";
principal \"4jijx-ekel7-4t2kx-32cyf-wzo3t-i4tas-qsq4k-ujnug-oxke7-o5aci-eae\"
};
commit = vec { principal \"detjl-sqaaa-aaaaq-aacqa-cai\"};
manage_permissions = vec { principal \"detjl-sqaaa-aaaaq-aacqa-cai\"}
}
}
})"
echo UPGRADE_ARG
# Make the proposal using quill
quill sns --canister-ids-file ../../utils/sns_canister_ids.json --pem-file $PEM_FILE make-upgrade-canister-proposal --title "$TITLE" --url "$URL" --summary "$SUMMARY" $PROPOSER_NEURON_ID --target-canister-id $TARGET_CANISTER_ID --wasm-path '../../../.dfx/ic/canisters/OpenFPL_frontend/assetstorage.wasm.gz' --canister-upgrade-arg "$UPGRADE_ARG" > msg.json
quill send msg.json
rm -f msg.json
I then ran the following dfx command to build my frontend to be uploaded via proposal:
dfx deploy OpenFPL_frontend --network ic --by-proposal
I then ran the following script to submit the proposal to update the frontend asset canister:
#!/bin/bash
# Set current directory to the scripts root
SCRIPT=$(readlink -f "$0")
SCRIPT_DIR=$(dirname "$SCRIPT")
cd $SCRIPT_DIR
TITLE="Update Frontend Canister."
SUMMARY="Update frontend canister with evidence batch id 205."
URL="https://openfpl.xyz"
EVIDENCE_STRING=9c3955d25c6fb1d28bff2f1f5df9d5b50f60d97e892caad03933e2622af4a797
BATCH_ID=205
FUNCTION_ID=24000
# Submit the proposal
../../utils/make_custom_function_proposal_frontend.sh $FUNCTION_ID "$TITLE" "$SUMMARY" "$URL" "$EVIDENCE_STRING" "$BATCH_ID" "commit_proposed_batch"