lukidoescode / yew-fullstack-boilerplate

Highly opinionated boilerplate for creating full stack applications with Rust
Apache License 2.0
58 stars 4 forks source link

WASM fails #8

Open thosaa opened 3 years ago

thosaa commented 3 years ago

Thank you! for a great boiler plate! I have been searching for a good boiler plate to get started with yew and this template contains a lot of goodies!

I'm having just one problem though... It does not work.

Disclaimer: I'm totally new to Yew and WASM.

Building the code is done easily using your scripts (Great job!) and the webpage is served. However, the WASM fails to execute.

Both Firefox and Chromium gives me this error, in the console, when started with run-dev.sh:

panicked at 'attempted to leave type `webcore::serialization::SerializedValue` uninitialized, which is invalid', /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/mem/mod.rs:658:9

Stack:

Error
    at Module.eval (webpack:///./pkg/index_bg.js?:613:15)
    at Module.eval (webpack:///./pkg/index_bg.js?:368:22)
    at __wbg_new_59cb74e423758ede (http://localhost:8000/yew-fullstack-frontend.js:146:98)
    at console_error_panic_hook::Error::new::hcf95f0ed927c2d54 (http://localhost:8000/yew-fullstack-frontend.wasm:wasm-function[11143]:0x29b25c)
    at console_error_panic_hook::hook_impl::h3d5784cd2082c04f (http://localhost:8000/yew-fullstack-frontend.wasm:wasm-function[1355]:0x154539)
    at console_error_panic_hook::hook::h7ade95c38d23fe43 (http://localhost:8000/yew-fullstack-frontend.wasm:wasm-function[12533]:0x2adf89)
    at core::ops::function::Fn::call::h0f39951f1bbc08e1 (http://localhost:8000/yew-fullstack-frontend.wasm:wasm-function[10147]:0x28bdca)
    at std::panicking::rust_panic_with_hook::hc5713da015ebaa19 (http://localhost:8000/yew-fullstack-frontend.wasm:wasm-function[2796]:0x1bc5ce)
    at std::panicking::begin_panic_handler::{{closure}}::hc5eba7f0030e8f4f (http://localhost:8000/yew-fullstack-frontend.wasm:wasm-function[13044]:0x2b463f)
    at std::sys_common::backtrace::__rust_end_short_backtrace::he811f0bd07938b42 (http://localhost:8000/yew-fullstack-frontend.wasm:wasm-function[13081]:0x2b4d01)

The rustc versions for both backend and frontend is:

root@bbbf27f3c5e9:/usr/src/backend# rustc --version
rustc 1.48.0 (7eac88abb 2020-11-16)

Just using the code as-is the login and signup are shown on the page, strecthed 100% in width. If I update most of the libraries, they are shown 'collapsed'.

Have you any idear of why I am getting this?

I will try to remove parts of code until I either makes it work or break it completely.

Regards Thomas

lukidoescode commented 3 years ago

Hi Thomas,

thanks a lot for reporting this issue. I will have to update this boilerplate to the latest version these days. There probably have been a lot of updates since I last touched it. Thank you for using it and for bringing it to my attention!

Lukas

lukidoescode commented 3 years ago

And you are getting these collapsed is probably because I need to update css-in-rust to handle newer yew versions.

thosaa commented 3 years ago

Hi Lukas

Well, I'm not using yet as it fails... :wink: But I'm hope to start using it soon.

HNY BTW

/Thomas

xosxos commented 3 years ago

The problem is actually in the web-logger crate. If you change to wasm-logger 0.2.0 it works.

You also have to change the line web_logger::init(); to

wasm_logger::init(wasm_logger::Config::default());

in the lib.rs file.