Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wasm32-wasi execution error #110

Closed
Tracked by #80
lastmjs opened this issue Jul 30, 2023 · 2 comments
Closed
Tracked by #80

wasm32-wasi execution error #110

lastmjs opened this issue Jul 30, 2023 · 2 comments

Comments

@lastmjs
Copy link

lastmjs commented Jul 30, 2023

While attempting to get Azle (TypeScript CDK) canisters to execute and generate Candid when compiled with the Rust target wasm32-wasi instead of wasm32-unknown-unknown, a strange error occurs when running the Wasm module through Node.js's Wasm implementation:

TypeError: Cannot convert undefined to a BigInt
    at _ZN98_$LT$ic_stable_structures..ic0_memory..Ic0StableMemory$u20$as$u20$ic_stable_structures..Memory$GT$4size17h89256a89bcb439a2E (wasm://wasm/0199407a:1:4105761)
    at _ZN20ic_stable_structures14memory_manager27MemoryManagerInner$LT$M$GT$4init17ha04bebf4d4296befE (wasm://wasm/0199407a:1:3516220)
    at _ZN20ic_stable_structures14memory_manager22MemoryManager$LT$M$GT$21init_with_bucket_size17h5e0e42ed2180b108E (wasm://wasm/0199407a:1:3950306)
    at _ZN20ic_stable_structures14memory_manager22MemoryManager$LT$M$GT$4init17h9a9d1e23253fbf80E (wasm://wasm/0199407a:1:4104022)
    at _ZN9stable_fs7storage6stable22StableStorage$LT$M$GT$23new_with_memory_indices17h0e60dcf7cf6f3de1E (wasm://wasm/0199407a:1:3053687)
    at _ZN9stable_fs7storage6stable22StableStorage$LT$M$GT$3new17he1c094322a45bf1dE (wasm://wasm/0199407a:1:4082606)
    at _ZN3std6thread5local4lazy21LazyKeyInner$LT$T$GT$10initialize17he20720e1b7c9fa00E (wasm://wasm/0199407a:1:3050734)
    at _ZN3std6thread5local6statik12Key$LT$T$GT$3get17h3fd4e9a8ddcfe4caE (wasm://wasm/0199407a:1:4032661)
    at _ZN16ic_wasi_polyfill2FS7__getit17h71b8f9ab5c334f9cE.llvm.3256719224495320100 (wasm://wasm/0199407a:1:4098671)
    at _ZN3std6thread5local17LocalKey$LT$T$GT$4with17h0c5f7d9a771ee26fE (wasm://wasm/0199407a:1:3399842)

I bring this up here because the error appears to come from ic-stable-structures. I wonder if there is some implementation issue with ic-stable-structures when compiling to wasm32-wasi (or at least when running through Node.js's VM)?

More information can be found in this companion issue: wasm-forge/ic-wasi-polyfill#9

@ielashi
Copy link
Contributor

ielashi commented Aug 17, 2023

Hey Jordan, this has been discussed in #108. This is not an issue with stable structures, but rather an issue with the how the SDK generates did files from candid. Per the discussion there, they will be fixing that issue on their side.

@ielashi ielashi closed this as completed Aug 17, 2023
@chenyan-dfinity
Copy link

I think this is a separate issue. We are still compiling with wasm32-unknown-unknown not wasm32-wasi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants