I think there’s an issue in the documentation of the periodic timers using rust. Here’s the link to the documentation (10: Using periodic timers | Internet Computer)
The command “dfx deploy my_timers_backend --argument 1” has an error. When we’re deploying the canister, we need to pass in the --argument flag (which is done) followed by the argument serialized in candid format. The argument in the command isn’t serialized in candid format.
The serialized format for a single integer is “(integer_value:nat64)”. Therefore the correct command should be: dfx deploy my_timers_backend --argument “(1:nat64)”
2 Likes
I didn’t try the tutorial, but I tried to deploy the example timer
canister using the latest dfx
:
a@b ~/tmp/examples/rust/periodic_tasks % dfx --version
dfx 0.19.0
a@b ~/tmp/examples/rust/periodic_tasks % git log -1 --oneline
688682ef (HEAD -> master, origin/master, origin/HEAD) ...
a@b ~/tmp/examples/rust/periodic_tasks % dfx deploy timer --argument 1
Deploying: timer
Creating canisters...
Creating canister timer...
Creating a wallet canister on the local network.
The wallet canister on the "local" network for user "Bob" is "bnz7o-iuaaa-aaaaa-qaaaa-cai"
timer canister created with canister id: bkyz2-fmaaa-aaaaa-qaaaq-cai
Building canisters...
[...]
Installing canisters...
Creating UI canister on the local network.
The UI canister on the "local" network is "bd3sg-teaaa-aaaaa-qaaba-cai"
Installing code for canister timer, with canister ID bkyz2-fmaaa-aaaaa-qaaaq-cai
Deployed canisters.
URLs:
Backend canister via Candid interface:
timer: http://127.0.0.1:4943/?canisterId=bd3sg-teaaa-aaaaa-qaaba-cai&id=bkyz2-fmaaa-aaaaa-qaaaq-cai
Seems everything just works…
I guess you missed the Declaring the Canister Interface step, but it’s hard to be sure without the actual code.