getsentry / sentry-javascript

Official Sentry SDKs for JavaScript
https://sentry.io
MIT License
8k stars 1.58k forks source link

cb is not a function Error #2113

Closed asadakbar closed 5 years ago

asadakbar commented 5 years ago
TypeError: cb is not a function
    at ClientRequest.<anonymous> (/Users/asad_a/Projects/hrt_web_project/node_modules/raven/lib/transports.js:53:13)
    at Object.onceWrapper (events.js:284:20)
    at ClientRequest.emit (events.js:201:15)
    at ClientRequest.EventEmitter.emit (domain.js:494:23)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:565:23)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:116:17)
    at TLSSocket.socketOnData (_http_client.js:452:22)
    at TLSSocket.emit (events.js:196:13)
    at TLSSocket.EventEmitter.emit (domain.js:494:23)
    at addChunk (_stream_readable.js:290:12)
    at readableAddChunk (_stream_readable.js:271:11)
    at TLSSocket.Readable.push (_stream_readable.js:226:10)
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:166:17)

Got this error when using the raven-node package. Turns out that Raven.captureMessage and Raven.captureException don't like it when the second or third arguments are empty objects. The second argument is used to identify the user context and the third is any extra pieces of info you want to pass to sentry.

I was occasionally sending empty objects when I didn't have the any relevant info but these functions were complaining. So now I pass them as arguments conditionally by array spreading.

I didnt find any documentation on this when trying to figure this out myself so adding it here for anyone else who hits it. Don't know if its an actual bug that needs fixing though.

asadakbar commented 5 years ago

This can be closed if its not an error that will be fixed.

kamilogorek commented 5 years ago

Sorry, but we don't support raven-js anymore. It'll receive security patches only.

asadakbar commented 5 years ago

Got it. The post can at least live on as documentation for anyone that hits the same issue I did.