dave / jsgo

GopherJS compiler, serving framework and CDN.
https://jsgo.io/<path>
MIT License
269 stars 11 forks source link

Running locally returns 500 error #20

Open magnuswahlstrand opened 5 years ago

magnuswahlstrand commented 5 years ago

I have followed the Running locallly guide, and get the server up and running. When I try to access it at localhost:8080 or http://localhost:8080/github.com/kyeett/adventure-island/ I just get a 500 error.

o run -tags "norwfs dev local" main.go                                 1 ↵

Unzipping assets...
2019/01/04 13:06:08 Listening on :8081
2019/01/04 13:06:08 Listening on :8082
2019/01/04 13:06:08 Listening on :8083
2019/01/04 13:06:08 Listening on :8080
dave commented 5 years ago

Hey I just pushed a v0.0.2 tag of jsgo which fixes a bug in the localfetcher which might resolve this problem... Give it a go and let me know!

magnuswahlstrand commented 5 years ago

Got the same error after running go get -u ... and the other steps, unfortunately

dave commented 5 years ago

Hmm was there anything outputted to the terminal by main.go?

dave commented 5 years ago

... and how about if you just hit http://localhost:8080/ with no path?

dave commented 5 years ago

.. and what happens if you hit http://localhost:8081/ ?

upsampled commented 5 years ago

I get the same error. Loading from 8080 is triggering an error when trying to _script.js. 8081 is just a redirect.

Terminal Output:

Unzipping assets...
2019/02/18 15:09:20 Listening on :8081
2019/02/18 15:09:20 Listening on :8082
2019/02/18 15:09:20 Listening on :8080
2019/02/18 15:09:20 Listening on :8083

8080 Request

GET /_script.js HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36
Accept: */*
Referer: http://localhost:8080/
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9

8080 Response

HTTP/1.1 500 Internal Server Error
Content-Type: text/plain; charset=utf-8
X-Content-Type-Options: nosniff
Date: Mon, 18 Feb 2019 20:10:44 GMT
Content-Length: 193

8081 Responce

HTTP/1.1 302 Found
Content-Type: text/html; charset=utf-8
Location: https://github.com/dave/jsgo
Date: Mon, 18 Feb 2019 20:12:58 GMT
Content-Length: 51
dave commented 5 years ago

OK the redirect from http://localhost:8081/ is expected. The root of compile.jsgo.io does a redirect to the Github repo. If you add a path to the URL - e.g. http://localhost:8081/foo.bar/baz it should deliver the page for compiling the foo.bar/baz package.

The 500 error from http://localhost:8080/_script.js is not expected... My next step would be to add a bit more debugging output in the ScriptHandler function - that's the function that should compile the github.com/dave/play GopherJS app and return the javascript... Try adding fmt.Println(err.Error()) before http.Error(w, err.Error(), 500).

I can't reproduce your error so it's tricky to debug... Let me know what you find out!

upsampled commented 5 years ago

Looks like that found it

cannot find package "github.com/dave/dropper" in any of:
        /usr/local/go/src/github.com/dave/dropper (from $GOROOT)
        /mnt/c/Users/liamk/Projects/godir/src/github.com/dave/dropper (from $GOPATH)
exit status 1

I probably just needed to have Modules turned on

dave commented 5 years ago

Aah ok you might need to do a go get -u github.com/dave/play - see if that fixes it...

dave commented 5 years ago

Oh, no you'll probably need modules turned off... Jsgo was created before modules and I haven't updated it to support them yet.

upsampled commented 5 years ago

I ran go get github.com/dave/dropper and go get -u github.com/dave/play , then reinitialized (go generate step) and it is running locally now

dave commented 5 years ago

Great! I'll add a note to the instructions about this.