wasmerio / winterjs

Winter is coming... ❄️
https://winterjs.org/
MIT License
2.93k stars 52 forks source link

import.meta causing rust to panic #81

Open ayonli opened 2 months ago

ayonli commented 2 months ago

Accessing the import.meta or import.meta.url property will cause the Rust thread to panic, even in an ES module.

thread '<unnamed>' panicked at /Users/arshia/.cargo/git/checkouts/spiderfire-8e3b631d39aa80f1/2a1b5be/runtime/src/module/loader.rs:121:53
Arshia001 commented 2 months ago

@ayonli thanks for reporting this!

Can you also post the panic message please?

ayonli commented 2 months ago

@Arshia001 The whole error message I got is this:

thread '<unnamed>' panicked at /Users/arshia/.cargo/git/checkouts/spiderfire-8e3b631d39aa80f1/2a1b5be/runtime/src/module/loader.rs:121:53:
called `Result::unwrap()` on an `Err` value: ()
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I tried to set the environment variable both in the .zshrc file or prepend it before the wasmer command, but none of them displays the backtrace.

Arshia001 commented 2 months ago

That's because you need to set it in the WASIX process. Try:

wasmer run wasmer/winterjs -e RUST_BACKTRACE=1 -- ....args

ayonli commented 2 months ago

@Arshia001 I managed to set the env variable via

wasmer run  wasmer/winterjs --env=RUST_BACKTRACE=full ...args

However, there is no backtrace printed, all I got is:

thread '<unnamed>' panicked at /Users/arshia/.cargo/git/checkouts/spiderfire-8e3b631d39aa80f1/2a1b5be/runtime/src/module/loader.rs:121:53:
called `Result::unwrap()` on an `Err` value: ()
stack backtrace:

The backtrace is somehow lost.

Arshia001 commented 2 months ago

Oh well, we tried!

I'll look into this.