chinedufn / percy

Build frontend browser apps with Rust + WebAssembly. Supports server side rendering.
https://chinedufn.github.io/percy/
Apache License 2.0
2.27k stars 84 forks source link

Example crashes after clicking button #9

Closed mikeyobrien closed 6 years ago

mikeyobrien commented 6 years ago

Error summary:

Listening on port 7878 Incoming connection GET / HTTP/1.1 Host: localhost:7878 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:61.0) Gecko/20100101 Firefox/61.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Connection: keep-alive Upgrade-Insecure-Requests: 1 Cache-Control: max-age=0

/Users/mobrien/projects/percy FILENAME: ./examples/isomorphic/client/ Incoming connection GET /bundle.js HTTP/1.1 Host: localhost:7878 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:61.0) Gecko/20100101 Firefox/61.0 Accept: / Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Referer: http://localhost:7878/ Connection: keep-alive

/Users/mobrien/projects/percy FILENAME: ./examples/isomorphic/client/bundle.js thread 'main' panicked at 'File not found: Os { code: 2, kind: NotFound, message: "No such file or directory" }', libcore/result.rs:945:5 note: Run with RUST_BACKTRACE=1 for a backtrace.

chinedufn commented 6 years ago

Uh oh - hmm - are you starting the server using start.sh ?

thread 'main' panicked at 'File not found: Os { code: 2, kind: NotFound, message: "No such file or directory" }'

Seems like the bundle.js isn't being found here https://github.com/chinedufn/percy/blob/44d974d325a52b66e022c343eb6226b2644cb607/examples/isomorphic/server/src/server.rs#L81-L84 ..

Does ./examples/isomorphic/client/bundle.js exist in your file system?

eswr commented 6 years ago

@hmobrienv Does this problem only occur in chrome? (try to open http://127.0.0.1:7878 in firefox)

if so, add favicon.ico at ./examples/isomorphic/client/favicon.ico and start it.

FILENAME: ./examples/isomorphic/client/favicon.ico

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Custom { kind: InvalidData, error: StringError("stream did not contain valid UTF-8") }', libcore/result.rs:945:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.
mikeyobrien commented 6 years ago

@eswr Occurs in both firefox and chrome.

@chinedufn There is no bundle.js file in ./examples/isomorphic/client/bundle.js.

chinedufn commented 6 years ago

Hmm, mind pasting the output from when you run start.sh ? I’m thinking there might’ve been a webpack build error or something.

mikeyobrien commented 6 years ago

Sure thing,

warning: unused manifest key: package.private warning: unused manifest key: package.private Finished dev [unoptimized + debuginfo] target(s) in 0.07s ./examples/isomorphic/client/build-wasm.sh: line 6: wasm-bindgen: command not found warning: unused manifest key: package.private warning: unused manifest key: package.private Finished dev [unoptimized + debuginfo] target(s) in 0.07s Running target/debug/isomorphic-server Listening on port 7878

chinedufn commented 6 years ago

wasm-bindgen: command not found

It looks like you're missing one of the dependencies. Sorry! The instructions should have done a better job of explaining how to get yourself set up :(

I've updated the instructions to include the fact that you need to have nightly Rust and wasm-bindgen installed!

https://github.com/chinedufn/percy/tree/master/examples/isomorphic#running-locally

If those steps don't work for you let me know!