The following import pattern doesn’t seem to work. I can’t quite figure out why.
My hope here was to deploy the canisters and have access to the initializer object so I know who the “owner” is.
//usernamesBucket.mo
shared({ caller = initializer }) actor class() {
};
//main.mo
import Usernames "canister:usernamesBucket";
shared({ caller = initializer }) actor class() {
public query func greet() : async Text {
return "Hello world";
};
};
//dfx.json
{
"canisters": {
"usernamesBucket": {
"main": "src/backend/usernamesBucket.mo",
"type": "motoko"
},
"backend": {
"main": "src/backend/main.mo",
"type": "motoko",
"dependencies": [
"usernamesBucket"
]
},
"frontend": {
"dependencies": [
"usernames"
],
"frontend": {
"entrypoint": "src/frontend/public/index.js"
},
"source": [
"src/frontend/assets",
"dist/frontend/"
],
"type": "assets"
}
},
"defaults": {
"build": {
"packtool": ""
}
},
"dfx": "0.6.20",
"networks": {
"local": {
"bind": "127.0.0.1:8000",
"type": "ephemeral"
},
"tungsten": {
"providers": [
"https://gw.dfinity.network"
],
"type": "persistent"
}
},
"version": 1
}
Log
The build step failed for canister 'rwlgt-iiaaa-aaaaa-aaaaa-cai' with an embedded error: The command '"/home/steve/.cache/dfinity/versions/0.6.20/moc" "/home/steve/src/dfinity-vue-starter/src/backend/main.mo" "-o" "/home/steve/src/dfinity-vue-starter/.dfx/local/canisters/backend/backend.did" "--idl" "--actor-idl" "/home/steve/src/dfinity-vue-starter/.dfx/local/canisters/idl/" "--actor-alias" "backend" "rwlgt-iiaaa-aaaaa-aaaaa-cai" "--actor-alias" "usernamesBucket" "r7inp-6aaaa-aaaaa-aaabq-cai" "--package" "base" "/home/steve/.cache/dfinity/versions/0.6.20/base"' failed with exit status 'exit code: 2'.
Stdout:
Stderr:
Fatal error: exception "Assert_failure mo_idl/idl_to_mo.ml:107:9"
Raised at file "mo_idl/idl_to_mo.ml", line 107, characters 9-21
Called from file "pipeline/pipeline.ml", line 336, characters 20-67
Called from file "lang_utils/diag.ml", line 30, characters 27-30
Called from file "lang_utils/diag.ml", line 46, characters 20-25
Called from file "lang_utils/diag.ml", line 30, characters 27-30
Called from file "lang_utils/diag.ml", line 30, characters 27-30
Called from file "pipeline/pipeline.ml" (inlined), line 340, characters 20-42
Called from file "pipeline/pipeline.ml", line 342, characters 47-63
Called from file "pipeline/pipeline.ml", line 350, characters 21-52
Called from file "lang_utils/diag.ml", line 30, characters 27-30
Called from file "lang_utils/diag.ml", line 30, characters 27-30
Called from file "pipeline/pipeline.ml", line 430, characters 27-71
Called from file "exes/moc.ml", line 132, characters 24-53
Called from file "exes/moc.ml", line 186, characters 4-23