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

localhost:8000 displays a blank page after running cargo make serve #1

Closed
robwebbjr opened this issue Aug 26, 2019 · 8 comments

Comments

@robwebbjr
Copy link

@robwebbjr robwebbjr commented Aug 26, 2019

Hi.
Thanks for helping Seed to get off the ground.
Noob to webdev and Rust, but I followed instructions and got a blank page.

Page source shows:
`

<title>Conduit</title> <script type="module"> // https://rustwasm.github.io/docs/wasm-bindgen/examples/without-a-bundler.html import init from '/pkg/package.js'; init('/pkg/package_bg.wasm'); </script> `

I am running:
rustc 1.37.0 (eae3437df 2019-08-13)
on Xubuntu 19.04 Disco Dingo
in Firefox on a Dell G7.

I'd really like to use Seed with actors and WASM; is there anything I should know about using Seed with an actor model?

Thanks for your help

P.S. email is rob.webb.jr@gmail.com

@robwebbjr robwebbjr changed the title localhost:8000 displays a blank page after running cargo maske serve localhost:8000 displays a blank page after running cargo make serve Aug 26, 2019
@MartinKavik

This comment has been minimized.

Copy link
Member

@MartinKavik MartinKavik commented Aug 26, 2019

Hi, thanks for the first issue 🥇!

Some questions to investigate your blank page issue:

  1. What's your wasm-pack version? (just write wasm-pack --version to terminal)
  2. Does demo work for you?
  3. Have you tried other browsers? Which versions?
  4. Do you see errors in Firefox's and Chrome's web console? (js errors, warnings, etc or failed requests)
  5. Does cargo make test_h_firefox pass?
  6. Try to run cargo make build_release instead of build before cargo make serve. Does it help?

I'd really like to use Seed with actors and WASM; is there anything I should know about using Seed with an actor model?

There are only some examples with actor model in the server side, there is nothing like Yew's agents.
Just create a new issue in the main Seed's repository and write about your use-case / gist example - we will continue discussion about actors there.

Good luck!

@robwebbjr

This comment has been minimized.

Copy link
Author

@robwebbjr robwebbjr commented Aug 26, 2019

@MartinKavik

This comment has been minimized.

Copy link
Member

@MartinKavik MartinKavik commented Aug 26, 2019

http://localhost:8000/pkg/package.js” was blocked because of a disallowed
MIME type (“text/html”).

I think that browser modifies mime type or server sends incorrect.

Try:

  1. Run cargo make serve
  2. Open localhost:8000
  3. Look at the terminal where server is running, you should see something like:
MicroServer running on port 8000!
Serving .
Spa support: true. Root: index.html
A((File { resp: Response { status: 200, version: HTTP/1.1, headers: {"content-length": "1044", "c
ontent-type": "text/html", "accept-ranges": "bytes", "last-modified": "Tue, 16 Jul 2019 19:01:54
GMT"}, body: Body } },))
....

Find all content-types - I see:

  • text/html
  • application/javascript -> same for you?
  • application/wasm
  • text/html
  • image/jpeg
  • image/svg+xml

Or you can try edit index.html:
From:

<script type="module">

to:

<script type="module" crossorigin="anonymous">

(Source)

@robwebbjr

This comment has been minimized.

Copy link
Author

@robwebbjr robwebbjr commented Aug 26, 2019

@MartinKavik

This comment has been minimized.

Copy link
Member

@MartinKavik MartinKavik commented Aug 27, 2019

It's weird. I need to do more experiments - I'll install probably virtualbox with your version of Xubuntu tomorrow (it's 2.00 AM now in CZ) and I'll try to find out something.

BTW, is this part correct?:

Yeah, it's almost copy-pasted from official docs and the same code is executed in the demo.

I think it's something OS specific (bug / feature).
In the meantime, try to find out why you can't download geckodriver (And this from make test: Error: failed to download from
https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz
Caused by: [6] Couldn't resolve host name
)

@robwebbjr

This comment has been minimized.

Copy link
Author

@robwebbjr robwebbjr commented Aug 27, 2019

@MartinKavik

This comment has been minimized.

Copy link
Member

@MartinKavik MartinKavik commented Aug 27, 2019

The hardest problems have the simplest solutions.. look at c231f8a.

Explanation

  • Command build only compiles Rust but doesn't create Wasm file and its init. JS script. So that the file /pkg/package.js hasn't been ever created and because local server redirects what is not file to index (because we want to handle all routes by our application) => server returns text/html.

Note

  • I've tested it on Xubuntu with Firefox in VMware Player and it works. I've tested it also in Chrome but the whole browser freezes after a moment (however I saw a loaded application for a few seconds before crash). Probably Chrome bug - if I remember correctly Chrome was unstable with Wasm code even on Windows.

Close the issue, pls, if you don't have other questions :)

@robwebbjr

This comment has been minimized.

Copy link
Author

@robwebbjr robwebbjr commented Aug 27, 2019

Thank you.
Seed rocks, and Martin makes it better.

@robwebbjr robwebbjr closed this Aug 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.