Skip to content
This repository has been archived by the owner on Oct 29, 2021. It is now read-only.

Errors during first request of development server #73

Open
nanno77 opened this issue Mar 21, 2017 · 7 comments
Open

Errors during first request of development server #73

nanno77 opened this issue Mar 21, 2017 · 7 comments

Comments

@nanno77
Copy link

nanno77 commented Mar 21, 2017

It looks like make serve starts everything up nicely but upon the first request the go server panics and throws a TypeError

panic: TypeError: Not a function: [object Object]

goroutine 9 [running]:
main.newJSVM.func1(0xc420014600)
	/Users/nanno/go/src/github.com/nanno77/houston/server/react.go:199 +0x4d1
github.com/nanno77/houston/vendor/github.com/dop251/goja_nodejs/eventloop.(*EventLoop).RunOnLoop.func1()
	/Users/nanno/go/src/github.com/nanno77/houston/vendor/github.com/dop251/goja_nodejs/eventloop/eventloop.go:109 +0x31
github.com/nanno77/houston/vendor/github.com/dop251/goja_nodejs/eventloop.(*EventLoop).run(0xc42018e340, 0xc42018e601)
	/Users/nanno/go/src/github.com/nanno77/houston/vendor/github.com/dop251/goja_nodejs/eventloop/eventloop.go:116 +0x77
created by github.com/nanno77/houston/vendor/github.com/dop251/goja_nodejs/eventloop.(*EventLoop).Start
	/Users/nanno/go/src/github.com/nanno77/houston/vendor/github.com/dop251/goja_nodejs/eventloop/eventloop.go:87 +0x44

I can't for the life of me figure out where this is going wrong. make install works without any errors, even make build works, but upon running the server the error is thrown.

I would love to play with this project a little bit. If someone has any thoughts please let me know.

@scarmuega
Copy link

I have the same exact behavior, I'll try to pull from a previous commit to see if symptoms change.

@nanno77
Copy link
Author

nanno77 commented Mar 22, 2017

@scarmuega circling back on this one. I roughly figured out the problem as it pertains to me.
Basically it was a JS error with Webpack not liking the syntax of require. Once I changed those to import in the sample app it all loaded up fine. It could be due to how I have babel configured globally, but I haven't had much time to dive into that.

@ufukomer
Copy link
Contributor

ufukomer commented Apr 23, 2017

I get the similar error when I update React from 14.0.0 to 15.0.0 and have no require in my code.

screen shot 2017-04-23 at 10 58 15 pm

Have an idea? (No changes on react.go)

@ufukomer
Copy link
Contributor

ufukomer commented Apr 24, 2017

Finally, I found the error. This is what happens when you update React and don't update Helmet. Goja does not show the error line in bundle.js which makes debugging process very hard. Isn't there an easier way for this?

@olebedev
Copy link
Owner

@ufukomer, great!

Could you send a PR with updated deps?

@iKonrad
Copy link

iKonrad commented Apr 24, 2017

I was trying to update all the deps as well but it took me way too long and resigned.

Anyway, make sure to temporarily turn off server side rendering when you update dependencies, it'll make it easier to track down all the issues.

@ufukomer
Copy link
Contributor

@iKonrad If you disable server rendering you won't get most of these errors. 😁

Let's turn this issue into print stack trace of goja errors. That is a goja issue lol. Check this out: dop251/goja#28 (comment)

Though it does not help much but better than none.

@olebedev I made lots of changes. I need to fork and update from scratch. So I can do it in the future, not today. By the way, I have not migrated to React Router v4. It is very complex to me for now. There are lots of changes in API. For example, no more onEnter method of a router. So we should fetch in the componentDidMount for client side. Therefore that requires changes on server code too, something like passing init values (store's initialState -> config values in our app) into template directly from Go instead of fetching it during the server render. Am I right?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants