question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"callback" argument must be a function

See original GitHub issue

I’m getting the following error after starting the server:

TypeError: "callback" argument must be a function
    at exports.setTimeout (timers.js:327:11)
    at WebSocketConnection.setKeepaliveTimer (pathToProject/node_modules/websocket/lib/WebSocketConnection.js:215:32)
    at WebSocketConnection.handleSocketData (pathToProject/node_modules/websocket/lib/WebSocketConnection.js:263:10)
    at emitOne (events.js:96:13)
    at TLSSocket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at TLSSocket.Readable.push (_stream_readable.js:134:10)
    at TLSWrap.onread (net.js:548:20)

I’m using version 6.9.1 of node.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
theturtle32commented, Dec 29, 2016

Fixed by #251

1reaction
braytakcommented, Dec 27, 2016

@ibc: a debug run revealed the following and a fix:

  • WebSocketConnection.handleSocketData calls the object’s setKeepaliveTimerHandler which references the object’s _keepaliveTimerHandler property as the setTimeout function
  • since the WebSocketConnection constructor function creates the referenced property only in the case where the keepalive and useNativeKeepalive configuration members are set to true' and falserespectively, thesetTimeout` function argument is the undefined.

I got rid of the exception by moving the _keepaliveTimerHandler property definition out of the conditional statement (to right after the _closeTimerHandler property definition).

Cheers

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: "callback" argument must be a function
Background. setInterval expects a function as the first parameter. In your code setInterval(upload_random_image(), 10000);.
Read more >
TypeError: callback is not a function in JavaScript | bobbyhadz
The "callback is not a function" error occurs when we define a callback parameter to a function, but invoke the function without passing...
Read more >
TypeError: "callback" argument must be a function when ...
Works when not running with the newrelic agent. Fails when the agent is enabled. TypeError: "callback" argument must be a function at setTimeout ......
Read more >
“callback” argument must be a function Node.js - iTecNote
Node.js – “callback” argument must be a function Node.js. node.js. I'm getting this error on "callback", this is the only part of the...
Read more >
Callback must be a function Received undefined - YouTube
Join this channel to get access to perks:https://www.youtube.com/channel/UCoSpmr2KNOxjwE_B9ynUmig/joinMy GearCamera ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found