Flotype / now

NowJS makes it easy to build real-time web apps using JavaScript
http://www.nowjs.com
MIT License
1.91k stars 175 forks source link

Error with latest version of Express #30

Closed nsmeta closed 13 years ago

nsmeta commented 13 years ago

Hello, I'm having this error every time I load a page, regardless of if I have included now.js script on client-side. My guess would be, it's because of latest version of Connect Middleware; since they have updated their APIs. I'm on Mac OS, Google Chrome(though, the same error appears with Firefox as well). I would really appreciate your help.

Thank You.

 { stack: [Getter/Setter],
 arguments: 
 [ 'indexOf',
 { stack: [Object],
   connections: 6,
   allowHalfOpen: true,
   watcher: [Object],
   _events: [Object],
   httpAllowHalfOpen: false,
   match: [Object],
   lookup: [Object],
   settings: [Object],
   redirects: {},
   isCallbacks: {},
   viewHelpers: [Object],
   dynamicViewHelpers: [Object],
   errorHandlers: [],
   route: '/',
   routes: [Object],
   router: [Getter],
   __usedRouter: true,
   type: 'tcp4',
   fd: 9 } ],
 type: 'undefined_method',
 message: [Getter/Setter] }
 TypeError: Object #<HTTPServer> has no method 'indexOf'
 at HTTPServer.<anonymous> (/Users/Me/Work/testing/app.coffee:11:19)
 at HTTPServer.<anonymous>              (/usr/local/lib/node/.npm/now/0.3.2/package/lib/nowServerLib.js:293:31)
at HTTPServer.<anonymous> (/usr/local/lib/node/.npm/socket.io/0.6.16/package/lib/socket.io/listener.js:35:20)
at HTTPServer.emit (events.js:67:17)
at HTTPParser.onIncoming (http.js:1108:12)
at HTTPParser.onHeadersComplete (http.js:108:31)
at Socket.ondata (http.js:1007:22)
at Socket._onReadable (net.js:677:27)
at IOWatcher.onReadable [as callback] (net.js:177:10)
sridatta commented 13 years ago

Thanks for reporting the issue. Looking into this right now. --Sridatta

nsmeta commented 13 years ago

Thanks for the quick response!

NowJS v0.3.2 Connect v1.2.1 Express v2.2.0

sridatta commented 13 years ago

I'm at the same versions as you and I'm unable to reproduce this problem on the Express chat example found here (https://github.com/Flotype/now/tree/master/examples/express_example). Can you tell me if this example is working for you?

nsmeta commented 13 years ago

Everything works. Well, this is embarrassing; I've found what seems to be the problem. I'm using a custom extension to the Array object, below(in CoffeeScript). Array::remove = (e) -> @[t..t] = [] if (t = @.indexOf(e)) > -1

I apologize for this; my bad. Thank you so much for helping me out.

sridatta commented 13 years ago

No problem. I'm glad you found the bug.