Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

TypeError: Cannot call method 'apply' of undefined in now/lib/user.js #171

mikl opened this Issue Jan 9, 2012 · 3 comments


None yet
3 participants

mikl commented Jan 9, 2012

I encountered this traceback in our logs today, just after a restart of the Now.js server. The remarkable part is that the traceback is entirely between Now.js and Socket.io, i.e., it would seem that our own code is not the cause:

[TypeError: Cannot call method 'apply' of undefined]
TypeError: Cannot call method 'apply' of undefined
  at Socket.rfcHandler (/srv/www/drupal7/profiles/lektier/spravka/node_modules/now/lib/user.js:101:19)
  at Socket.$emit (events.js:67:17)
  at SocketNamespace.handlePacket (/srv/www/drupal7/profiles/lektier/spravka/node_modules/now/node_modules/socket.io/lib/namespace.js:335:22)
  at Manager.onClientMessage (/srv/www/drupal7/profiles/lektier/spravka/node_modules/now/node_modules/socket.io/lib/manager.js:462:38)
  at WebSocket.onMessage (/srv/www/drupal7/profiles/lektier/spravka/node_modules/now/node_modules/socket.io/lib/transport.js:387:20)
  at Parser.<anonymous> (/srv/www/drupal7/profiles/lektier/spravka/node_modules/now/node_modules/socket.io/lib/transports/websocket/hybi-16.js:40:10)
  at Parser.emit (events.js:67:17)
  at /srv/www/drupal7/profiles/lektier/spravka/node_modules/now/node_modules/socket.io/lib/transports/websocket/hybi-16.js:289:16
  at Parser.expectHandler (/srv/www/drupal7/profiles/lektier/spravka/node_modules/now/node_modules/socket.io/lib/transports/websocket/hybi-16.js:300:15)
  at Parser.add (/srv/www/drupal7/profiles/lektier/spravka/node_modules/now/node_modules/socket.io/lib/transports/websocket/hybi-16.js:467:24)

mikl commented Jan 9, 2012

It also occurred later without a restart of the server, so there's something strange going on. It could ostensibly be worked around by checking theFunction before call()'ing it.

These are the versions I'm using:

├─┬ now@0.7.6 
│ ├── node-proxy@0.5.2 
│ └─┬ socket.io@0.8.7 
│   ├── policyfile@0.0.4 
│   ├── redis@0.6.7 
│   └─┬ socket.io-client@0.8.7 
│     ├── uglify-js@1.0.6 
│     ├── websocket-client@1.0.0 
│     └── xmlhttprequest@1.2.2 

True. this error may occur when you emit a remote function call on a fqn whose function is undefined. please check the branch removegroup(./lib/user.js) from line 110. Is it what you suggested?


steveWang commented Jan 15, 2012

This still doesn't resolve the fundamental issue: why are remote function calls being requested for undefined functions? I imagine no manual injections are at work, so an initial guess would be a closure call. If you can figure out how to replicate the error, I'd appreciate it if you could turn up log level to 3 and provide some more detailed output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment