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

Fix crash in getrandom on Electron/Vue desktop app #623

Open
greenhat opened this issue Sep 6, 2022 · 0 comments
Open

Fix crash in getrandom on Electron/Vue desktop app #623

greenhat opened this issue Sep 6, 2022 · 0 comments

Comments

@greenhat
Copy link
Member

greenhat commented Sep 6, 2022

Attempted to fix in #620

trace:

panicked at 'could not initialize thread_rng: Node.js crypto module is unavailable', /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.8.5/src/rngs/thread.rs:72:17

Stack:

Error
    at __wbg_new_693216e109162396 (webpack-internal:///./node_modules/ergo-lib-wasm-browser/ergo_lib_wasm_bg.js:6914:17)
    at console_error_panic_hook::hook::h992992de3f0fa9b9 (wasm://wasm/00ffe776:wasm-function[1812]:0x198005)
    at core::ops::function::Fn::call::hc810e5369804b9f1 (wasm://wasm/00ffe776:wasm-function[10901]:0x29a677)
    at std::panicking::rust_panic_with_hook::h1c368a27f9b0afe1 (wasm://wasm/00ffe776:wasm-function[2967]:0x1e955f)
    at std::panicking::begin_panic_handler::{{closure}}::h8e1f8b682ca33009 (wasm://wasm/00ffe776:wasm-function[4676]:0x236ce4)
    at std::sys_common::backtrace::__rust_end_short_backtrace::h7f7da41799766719 (wasm://wasm/00ffe776:wasm-function[9950]:0x2973b2)
    at rust_begin_unwind (wasm://wasm/00ffe776:wasm-function[7859]:0x281b8c)
    at core::panicking::panic_fmt::hcdb13a4b2416cf82 (wasm://wasm/00ffe776:wasm-function[7922]:0x2829f3)
    at std::thread::local::lazy::LazyKeyInner<T>::initialize::hc4dfa70367192fbc (wasm://wasm/00ffe776:wasm-function[1709]:0x18ea94)
    at rand::rngs::thread::THREAD_RNG_KEY::__getit::h8a182064bee393d6 (wasm://wasm/00ffe776:wasm-function[9567]:0x295009)

Fix:

Looks like this rust-random/getrandom#256 (comment) works 🥳
still running some tests but that seems to be the solution for us. Using browser wasm version and adding the at the end of the bindings file

Even better fix:
Figure out why cardano-serialization-lib JS bindings work and use the same approach.

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

1 participant