open-chat
open-chat copied to clipboard
question about post_upgrade failed
Hi there, I wrote my own post_upgrade code by researching the openchat post_upgrade, but it prints:
Error: Failed while trying to deploy canisters.
Caused by: Failed while trying to deploy canisters.
Failed while trying to install all canisters.
Failed to install wasm module to canister 'user'.
Failed during wasm installation call: The replica returned a replica error: Replica Error: reject code CanisterError, reject message Canister g5fwl-3aaaa-aaaah-adtlq-cai trapped explicitly: Panicked at 'called Result::unwrap()
on an Err
value: InvalidMarkerRead(Error { kind: UnexpectedEof, message: "failed to fill whole buffer" })', src/user/impl/src/lifecycle/post_upgrade.rs:18:53, error code None
I don't know why, here is my code:
#[post_upgrade]
fn post_upgrade() {
let env = init_env();
let memory = get_upgrade_memory();
let reader = get_reader(&memory);
let data: Data= serializer::deserialize(reader).unwrap();
init_state(env, data);
reset_memory_manager();
info!("Post-upgrade complete");
}