Skip to content
This repository has been archived by the owner on Apr 16, 2022. It is now read-only.

README example doesn't work #10

Closed
johnpmayer opened this issue Jan 31, 2021 · 5 comments
Closed

README example doesn't work #10

johnpmayer opened this issue Jan 31, 2021 · 5 comments

Comments

@johnpmayer
Copy link

README example doesn't work (002a7ae)

Maybe this is due to using wasm-bindgen directly, rather than wasm-pack?

simple.js:323 panicked at 'could not initialize thread_rng: getrandom: this target is not supported', /Users/johnmayer/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/rand-0.7.3/src/rngs/thread.rs:65:17

Stack:

Error
    at imports.wbg.__wbg_new_59cb74e423758ede (http://127.0.0.1:4000/target/simple.js:329:19)
    at console_error_panic_hook::Error::new::h494e4956a227c339 (http://127.0.0.1:4000/target/simple_bg.wasm:wasm-function[14203]:0x2d7278)
    at console_error_panic_hook::hook_impl::h8f2c406d1778ae80 (http://127.0.0.1:4000/target/simple_bg.wasm:wasm-function[1406]:0x12e4d2)
    at console_error_panic_hook::hook::h4aa82df0ae9adfe2 (http://127.0.0.1:4000/target/simple_bg.wasm:wasm-function[15742]:0x2ecdfd)
    at core::ops::function::Fn::call::ha7ab20e537201524 (http://127.0.0.1:4000/target/simple_bg.wasm:wasm-function[13176]:0x2c7110)
    at std::panicking::rust_panic_with_hook::h123718ba3bf480af (http://127.0.0.1:4000/target/simple_bg.wasm:wasm-function[2994]:0x1a4468)
    at std::panicking::begin_panic_handler::{{closure}}::hf393a82e58397bd2 (http://127.0.0.1:4000/target/simple_bg.wasm:wasm-function[5444]:0x2132b1)
    at std::sys_common::backtrace::__rust_end_short_backtrace::h2ff2cfc953878925 (http://127.0.0.1:4000/target/simple_bg.wasm:wasm-function[16947]:0x2fc2fe)
    at rust_begin_unwind (http://127.0.0.1:4000/target/simple_bg.wasm:wasm-function[15260]:0x2e66e5)
    at std::panicking::begin_panic_fmt::h96153d9dc0e882ed (http://127.0.0.1:4000/target/simple_bg.wasm:wasm-function[16763]:0x2f9fc5)

simple_bg.wasm:0x30ddad Uncaught (in promise) RuntimeError: unreachable
    at __rust_start_panic (http://127.0.0.1:4000/target/simple_bg.wasm:wasm-function[19154]:0x30ddad)
    at rust_panic (http://127.0.0.1:4000/target/simple_bg.wasm:wasm-function[17584]:0x302e8a)
    at std::panicking::rust_panic_with_hook::h123718ba3bf480af (http://127.0.0.1:4000/target/simple_bg.wasm:wasm-function[2994]:0x1a448f)
    at std::panicking::begin_panic_handler::{{closure}}::hf393a82e58397bd2 (http://127.0.0.1:4000/target/simple_bg.wasm:wasm-function[5444]:0x2132b1)
    at std::sys_common::backtrace::__rust_end_short_backtrace::h2ff2cfc953878925 (http://127.0.0.1:4000/target/simple_bg.wasm:wasm-function[16947]:0x2fc2fe)
    at rust_begin_unwind (http://127.0.0.1:4000/target/simple_bg.wasm:wasm-function[15260]:0x2e66e5)
    at std::panicking::begin_panic_fmt::h96153d9dc0e882ed (http://127.0.0.1:4000/target/simple_bg.wasm:wasm-function[16763]:0x2f9fc5)
    at rand::rngs::thread::THREAD_RNG_KEY::__init::{{closure}}::h8ae4330291bfd8f8 (http://127.0.0.1:4000/target/simple_bg.wasm:wasm-function[3734]:0x1cb502)
    at core::result::Result<T,E>::unwrap_or_else::h633a94d6b0dafd1c (http://127.0.0.1:4000/target/simple_bg.wasm:wasm-function[748]:0xe029f)
    at rand::rngs::thread::THREAD_RNG_KEY::__init::h5b5b278c06a41cb3 (http://127.0.0.1:4000/target/simple_bg.wasm:wasm-function[1507]:0x137f8e)
@smokku
Copy link
Owner

smokku commented Feb 2, 2021

This is because Bevy 0.4.0 does not work on WASM out of the box.
As you can see in the included stacktrace it uses rand-0.7.3, which needs wasm-bindgen feature enabled to work on WASM.
I'm pretty sure I tested WASM and it worked with the release. 😕

Anyway, thank you for the report.
I synced rand dependency and added the required feature on master.

@smokku smokku closed this as completed Feb 2, 2021
@johnpmayer
Copy link
Author

Confirmed fixed, thanks!

@johnpmayer
Copy link
Author

As the fix for this change was an issue with the package's dependencies, can you publish a fix as 0.1.1?

@johnpmayer
Copy link
Author

johnpmayer commented Feb 14, 2021

In addition, might need to move rand to a regular dependency - I'm getting an error when trying to use the crate from master:

the package arugio_client depends on bevy_networking_turbulence, with features: rand but bevy_networking_turbulence does not have these features.

@smokku
Copy link
Owner

smokku commented Feb 14, 2021

As the fix for this change was an issue with the package's dependencies, can you publish a fix as 0.1.1?

Makes sense.
But as we have a different NetworkingPlugin API it went as 0.2.

PR to update arugio is here: ostwilkens/arugio#1

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

No branches or pull requests

2 participants