In my nodejs
express
project, I am trying to set up emails on errors. using winston
& winston-mail
pkgs
I get the following error:
{
"date": "Wed May 17 2017 12:36:54 GMT+0530 (IST)",
"process": { "pid": 22443, "uid": 502, "gid": 20, "cwd": "/Users/shezad/workspace/goblin", "execPath": "/usr/local/Cellar/node/7.8.0/bin/node", "version": "v7.8.0", "argv": ["/usr/local/Cellar/node/7.8.0/bin/node", "/Users/shezad/workspace/goblin/server.js"], "memoryUsage": { "rss": 52514816, "heapTotal": 37646336, "heapUsed": 24661328, "external": 698215 } },
"os": { "loadavg": [1.8125, 1.763671875, 1.7275390625], "uptime": 1126961 },
"trace": [{
"column": 13,
"file": "/Users/shezad/workspace/goblin/node_modules/emailjs/smtp/error.js",
"function": "module.exports",
"line": 3,
"method": "exports",
"native": false
}, {
"column": 29,
"file": "/Users/shezad/workspace/goblin/node_modules/emailjs/smtp/response.js",
"function": "TLSSocket.error",
"line": 26,
"method": "error",
"native": false
}, {
"column": 20,
"file": "events.js",
"function": "emitOne",
"line": 101,
"method": null,
"native": false
}, {
"column": 7,
"file": "events.js",
"function": "TLSSocket.emit",
"line": 191,
"method": "emit",
"native": false
}, {
"column": 8,
"file": "net.js",
"function": "emitErrorNT",
"line": 1284,
"method": null,
"native": false
}, {
"column": 11,
"file": "internal/process/next_tick.js",
"function": "_combinedTickCallback",
"line": 80,
"method": null,
"native": false
}, {
"column": 9,
"file": "internal/process/next_tick.js",
"function": "process._tickCallback",
"line": 104,
"method": "_tickCallback",
"native": false
}],
"stack": ["Error: connection encountered an error",
" at module.exports (/Users/shezad/workspace/goblin/node_modules/emailjs/smtp/error.js:3:13)",
" at TLSSocket.error (/Users/shezad/workspace/goblin/node_modules/emailjs/smtp/response.js:26:29)",
" at emitOne (events.js:101:20)",
" at TLSSocket.emit (events.js:191:7)",
" at emitErrorNT (net.js:1284:8)",
" at _combinedTickCallback (internal/process/next_tick.js:80:11)",
" at process._tickCallback (internal/process/next_tick.js:104:9)"
],
"level": "error",
"message": "uncaughtException: connection encountered an error",
"timestamp": "2017-05-17T07:06:54.696Z"
}
My logger.js file is like follow
var logger = new(winston.Logger)({
transports: [
new(winston.transports.Console)({colorize:true}),
new(winston.transports.File)(config.logging.file_options),
new(winston.transports.Mail)(config.logging.mail_options)
],
exceptionHandlers: [
new (winston.transports.Mail)(config.logging.mail_options)
]
});
Configuration for logging is as such
config.logging = {
file_options: {
name: 'app-log',
filename: './logs/app.log',
level: 'info',
timestamp: true,
colorize: true,
handleExceptions: true,
humanReadableUnhandledException: true,
prettyPrint: true,
json: true,
maxsize: 512 * 1024
},
mail_options: {
to: ['dummy@blackbuck.com'],
from: '***@blackbuck.com',
subject: format('[{0}]', config.stage_name.toUpperCase()) + ' : ',
host: 'smtp.gmail.com',
port: 587,
username: '***@blackbuck.com',
password: '******',
ssl: true,
prettyPrint: true,
}
};
Can somebody please explain what this error is? and how to rectify it? Thanks in ad
via Crazyshezy
No comments:
Post a Comment