strongloop / modern-syslog

modern-syslog
Other
49 stars 19 forks source link

Doesn't seem to work with node v6.4.0 #19

Closed nschoe closed 7 years ago

nschoe commented 8 years ago

So I've updated node to 6.4.0 and the application was crashing severely and my handler for process.on ('uncaughtException') was triggered. It is passed an err argument which I displayed on the console.

Weirdly, what I got on the console was: TypeError: undefined is not a function. That's it, no stack, no code, nothing. The err object was an instance or Error, but that's all. I could no get any information from where the bloody error came from.

We kept stuck on this for 3 entire days ^^

We have finally managed to isolate the problem (magically really because we had about nowhere to begin) to a call Logger.notice (...). So we went up to our Logger module, and finally narrowed it down to a call Syslog.log(...) where Syslog is require ('modern-syslog').

I haven't had time to properly inspect the code, but guys, somewhere you must be throwing a string as an error or something like this, because there was no stack and it killed me.

Bonus point: I stumbled on the README.md which says "Note that syslog functions cannot fail, and neither throw errors, nor callback". I have to admit I might have called you names...

Anyway, you might to take a look into that, I suspect that this happens when you call code inside the core.cc file, but again, not sure, I haven't had time to inspect further.

johnspackman commented 8 years ago

I've just had exactly the same experience; this code is all that is required to reproduce the problem:

var Syslog = require('modern-syslog');

Syslog.log(Syslog.LOG_WARNING, "hello");

Output is:

$ node test/test-syslog.js
undefined:0

TypeError: undefined is not a function

This happens on 32-bit node v6.5.0 running on Debian 8, using modern-syslog 1.1.3 installed via npm.

johnspackman commented 8 years ago

The fix is already complete one month ago in https://github.com/strongloop/modern-syslog/pull/17 but not released on npm - please release a new version, this just cost me 8 hours of trial and error to track down the cause

msimerson commented 8 years ago

+1, please cut a new release for node v6 compatibility.

nschoe commented 8 years ago

I'm glad I'm not the only one. Seems weird they don't respond, I hope they will npm publish soon.

johnspackman commented 8 years ago

I found that to use the plugin direct from git instead of the npm one, change the package.json to this:

"dependencies": {
    "modern-syslog": "git+https://github.com/strongloop/modern-syslog.git"
rmg commented 7 years ago

Closing, assuming this was indeed fixed by #17 which was part of v1.1.4 on Sept. 30.

@nschoe please re-open if this is still a problem for you.