Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Error: Uncaught, unspecified 'error' event. #22

Closed
jechenique opened this Issue · 13 comments

2 participants

@jechenique

Hi,
I've been using Raven for a project and I haven't had any issues during development.
When deploying it to Heroku, and after parsing a csv file using node-csv-parser the following error is displayed (and the server is restarted):

events.js:73
throw new Error("Uncaught, unspecified 'error' event.");
^
Error: Uncaught, unspecified 'error' event.
at Client.EventEmitter.emit (events.js:73:15)
at IncomingMessage.HTTPTransport.send (/app/node_modules/raven/lib/transports.js:31:22)
at IncomingMessage.EventEmitter.emit (events.js:126:20)
at IncomingMessage._emitEnd (http.js:366:10)
at HTTPParser.parserOnMessageComplete as onMessageComplete
at CleartextStream.socketOnData as ondata
at CleartextStream.CryptoStream._push (tls.js:526:27)
at SecurePair.cycle (tls.js:880:20)
at EncryptedStream.CryptoStream.write (tls.js:267:13)
at Socket.ondata (stream.js:38:26)

Can you please advise?

Thanks in advance

@mattrobenolt
Owner

What version of node are you using?

I'll look into what could be happening regardless.

The code path being hit in your code regardless is the Sentry server NOT returning back a 200 status code. So do you have Sentry set up correct?

@jechenique

Hi Matt,
thank you very much for your quick response.
I'm using v0.8.9

Regarding Sentry, I think it's correctly configured, since my app is reporting errors to Sentry and they're displayed in Sentry's site.

Regards

@mattrobenolt
Owner

And just to double check, which version of raven are you using?

@jechenique

Raven version: 0.4.3

Thx!

@mattrobenolt
Owner

@jechenique So what you got isn't an error with raven per-se. The Raven client emits an error event when it fails to deliver the message to Sentry for whatever reason. When node tries to emit that event, it sees that nothing is listening for the error, and in turn it decides to throw the exception.

What I'm going to do is by default, it will always bind one error handler that is a noop just to prevent the exception from bubbling up and actually being thrown.

This won't interfere with any other behavior, like, attaching your own error handler to detect when Sentry was down or had a hiccup or anything like that.

But again, you should double check if your Sentry configuration is right, because this code path was definitely hit from a non-200 response from the server.

Do you mind sending me your DSN with your secret key "xxx"'d out?

@jechenique

I captured the error and it's throwing a 403 - Forbidden error, but since the errors are being posted to Sentry I don't see why this error is being thrown.
I've send my DSN info to your email.

Thx!

@jechenique

Matt,
I've found something:
When parsing a file with node-csv (http://www.adaltas.com/projects/node-csv/), each line fires a different process (the file have 177 lines), and for several of them a warning is raised (since some data isn't present in order to insert the line into the DB) and this warning is reported to sentry.
Apparently, when several raven or sentry processes are called in parallel this error is thrown, since I commented the line reporting the error to sentry and the error is not being reproduced anymore.
When called one time everything works fine.

Am I being clear enough? Please let me know.

Regards

@mattrobenolt
Owner
@mattrobenolt
Owner

Also, can you get the response body back from the 403 error? It should provide a clue as to what was wrong.

@jechenique

Sorry, my bad... I used a wrong word.
Each line doesn't start a new process, since node.js is single threaded... what I wanted to say is that each line is async managed.

Regards

@jechenique

I can't find if there's a message inside the body... but I think I know what the problem is.
Since I'm still in development, I'm using Sentry's Free Developer plan, and it supports only 100 events per day.
Since my app is throwing several messages, I already used those 100 events.
I'll send these warning messages to the client instead of sending them to Sentry.

It would be great if you can catch this error in order to avoid the server crashing when this problem happens, and maybe you can warn the user that the problem might be that he's exceeding the events quota per day.

Thank you very much for your time.

@jechenique jechenique closed this
@mattrobenolt

@jechenique I fixed this behavior in v0.4.4

Check out the release notes: https://github.com/mattrobenolt/raven-node/blob/v0.4.4/History.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.