Canister backtraces aren’t working in Azle, I keep getting errors like this (dfx 0.24.3
):
dfx canister call async_await test
Error: Failed update call.
Caused by: The replica returned a rejection error: reject code CanisterError, reject message Error from Canister bkyz2-fmaaa-aaaaa-qaaaq-cai: Canister called `ic0.trap` with message: Uncaught TypeError: Error converting from js 'i32' into type 'u8': Overflow
at StableBTreeMap (.azle/async_await/main.js:5519:53)
at test (.azle/async_await/main.js:5758:19)
at getUnencodedResult (.azle/async_await/main.js:5069:18)
at executeAndReplyWithCandidSerde (.azle/async_await/main.js:5030:5)
at <anonymous> (.azle/async_await/main.js:5275:13)
Canister Backtrace:
unknown function at index 2927
unknown function at index 1734
unknown function at index 350
unknown function at index 2695
unknown function at index 46
unknown function at index 46
unknown function at index 46
unknown function at index 46
unknown function at index 363
unknown function at index 1737
unknown function at index 46
unknown function at index 993
unknown function at index 1398
unknown function at index 1038
unknown function at index 116
unknown function at index 3257
We don’t use any Wasm optimization that I know of that would strip the name
metadata section from the Wasm binary. We are using a dfx extension. I’ve tried adding back debug = true
to our release
profile in Cargo.toml, but that doesn’t seem to have any effect.
The name
section doesn’t appear to be included:
wasm-objdump -h .azle/async_await/async_await.wasm
async_await.wasm: file format wasm 0x1
Sections:
Type start=0x0000000b end=0x000004c7 (size=0x000004bc) count: 147
Import start=0x000004ca end=0x00000881 (size=0x000003b7) count: 41
Function start=0x00000884 end=0x00001545 (size=0x00000cc1) count: 3244
Table start=0x00001547 end=0x0000154e (size=0x00000007) count: 1
Memory start=0x00001550 end=0x00001553 (size=0x00000003) count: 1
Global start=0x00001555 end=0x000015a2 (size=0x0000004d) count: 11
Export start=0x000015a5 end=0x00001d38 (size=0x00000793) count: 69
Elem start=0x00001d3b end=0x0000254d (size=0x00000812) count: 1
DataCount start=0x0000254f end=0x00002550 (size=0x00000001) count: 4
Code start=0x00002555 end=0x002150e3 (size=0x00212b8e) count: 3244
Data start=0x002150e7 end=0x0032e8b7 (size=0x001197d0) count: 4
Custom start=0x0032e8ba end=0x0032e980 (size=0x000000c6) "producers"
Custom start=0x0032e982 end=0x0032e9d8 (size=0x00000056) "target_features"
Here’s our extension.json
for the azle
extension:
{
"name": "azle",
"version": "0.26.0",
"homepage": "https://github.com/dfinity/dfx-extensions",
"authors": "",
"summary": "",
"categories": [],
"keywords": [],
"canister_type": {
"defaults": {
"candid": ".azle/{{canister_name}}/{{canister_name}}.did",
"build": "node_modules/.bin/azle compile {{canister_name}}",
"post_install": "node_modules/.bin/azle upload-assets {{canister_name}}",
"wasm": ".azle/{{canister_name}}/{{canister_name}}.wasm",
"gzip": true,
"metadata": [
{
"name": "candid:service"
},
{
"name": "cdk:name",
"content": "azle"
}
],
"tech_stack": {
"cdk": {
"azle": {}
},
"language": {
"typescript": {},
"javascript": {}
}
}
}
}
}