browserquest / BrowserQuest

Continuing the development of Mozilla BrowserQuest
http://browserquest.herokuapp.com
Other
445 stars 219 forks source link

BQ server error when loading client web page: "TypeError: Cannot read property 'incoming' of undefined" #93

Closed brynnb closed 11 years ago

brynnb commented 11 years ago

On Ubuntu 12.04 with redis 2.6.14 and node v0.6.12.

I did a fresh install of everything and when loading the client page I get the following (every time I refresh it repeats itself):

GET /shared/js/gametypes.js 200 0ms
TypeError: Cannot read property 'incoming' of undefined
    at Object.handleDynamicPageRequests [as handle] (/root/BrowserQuest/server/js/ws.js:151:69)
    at next (/root/BrowserQuest/node_modules/connect/lib/proto.js:190:15)
    at Object.logger [as handle] (/root/BrowserQuest/node_modules/connect/lib/middleware/logger.js:156:5)
    at next (/root/BrowserQuest/node_modules/connect/lib/proto.js:190:15)
    at resume (/root/BrowserQuest/node_modules/connect/lib/middleware/static.js:60:7)
    at SendStream.error (/root/BrowserQuest/node_modules/connect/lib/middleware/static.js:73:37)
    at SendStream.emit (events.js:88:20)
    at SendStream.error (/root/BrowserQuest/node_modules/connect/node_modules/send/lib/send.js:147:51)
    at SendStream.onStatError (/root/BrowserQuest/node_modules/connect/node_modules/send/lib/send.js:248:48)
    at Object.oncomplete (/root/BrowserQuest/node_modules/connect/node_modules/send/lib/send.js:320:26)
GET /config/config_build.json 500 4ms - 945b

I probably just configured something wrong. Any ideas?

brynnb commented 11 years ago

Also worth noting that logging in or creating a character doesn't actually work. The login and create buttons do nothing.

justinclift commented 11 years ago

Interesting. That's the problem @Aaron1011 was seeing on OpenShift.

Just to see what happens, can you try reverting your git repo to (say) a week or so ago, and see if the same problem keeps on happening.

It'll be interesting to see if it's a problem with recent-ish code, or if maybe one of our npm dependencies is interacting badly with us.

justinclift commented 11 years ago

Also, which browsers is this happening for (just in case)? :smile:

Aaron1011 commented 11 years ago

Hmm. As @justinclift mentioned, this is the same problem I'm experiencing on Openshift. However, I can't seem to reproduce it locally with the latest code.

justinclift commented 11 years ago

@Aaron1011 - Hmmm, have you tried with node 0.6.12?

Aaron1011 commented 11 years ago

Actually, I haven't. I'm just trying it now.

Aaron1011 commented 11 years ago

I haven''t been able to test it locally with Node 0.6 yet (nvm is still compiling it), but on Openshift, 0.10 is being used (I'm manually checked through SSH).

Aaron1011 commented 11 years ago

According to the Connect README, it should be compatible with Node 0.6.x.

Aaron1011 commented 11 years ago

Aha! It seems that I'm having the problem too with Node 0.6. We should probably report this as a bug to Connect.

Aaron1011 commented 11 years ago

The question now, of course, is why it's happening on Openshift.

justinclift commented 11 years ago

Understood. If the problem does show up locally for you with 0.6.12, then it could mean there's something left over with the OpenShift node-0.6 cartridge causing problems. Even though technically 0.10 is what's being executed.

justinclift commented 11 years ago

@Aaron1011 - Cool. Would you be ok to try with node 0.8. as well? The result with that will be useful for a bug report to the Connect people.

Aaron1011 commented 11 years ago

Everything is working fine with Node 0.8. I'll open an issue on their repository, and try to double-check the version of Node actually in use on Openshift.

justinclift commented 11 years ago

@Aaron1011 - Cool. :smile:

We should update our README.md as well, to advise people to use Node.js 0.8.x or 0.10.x for now. I'll do that right away.

@brynnb - Are you ok to use a newer Node.js?

justinclift commented 11 years ago

@Aaron1011 - As a thought, now that you can reproduce it locally with 0.6.x, you could set a breakpoint on line 151 of ws.js and see what's wrong with the request when it happens.

Something obvious might turn up from that. (I hope) :smile:

Aaron1011 commented 11 years ago

I think the problem is something internal to connect, in that a property is not getting set on the object that it returns.

brynnb commented 11 years ago

@Aaron1011 Of course, no problem to use newer node. Thanks for all the responses!

Aaron1011 commented 11 years ago

I've just determined that Openshift is in fact using Node 0.6, despite what I'd though earlier. I'll work on getting it to use Node 0.10, but at least now we know what the problem is. Hopefully the people at Connect will get back to us soon.

brynnb commented 11 years ago

I guess we should close this since it isn't ours to fix and the README has been updated?

brynnb commented 11 years ago

Going ahead and closing, updating node to 0.8.x fixed it as expected.

justinclift commented 11 years ago

Cool. :smile:

brynnb commented 11 years ago

Worth adding that the guy over at connect (https://github.com/senchalabs/connect/issues/858) claims this isn't their code breaking @justinclift @Aaron1011