You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If req.header contains a property whose value is undefined then the koa2-winston logger raises an exception with a stack trace like this:
TypeError: Cannot read property 'toString' of undefined
at $asString (eval at build (/path/node_modules/fast-json-stringify/index.js:149:20), <anonymous>:16:15)
at $mainreqheader (eval at build (/path/node_modules/fast-json-stringify/index.js:149:20), <anonymous>:371:44)
at $mainreq (eval at build (/path/node_modules/fast-json-stringify/index.js:149:20), <anonymous>:229:17)
at $main (eval at build (/path/node_modules/fast-json-stringify/index.js:149:20), <anonymous>:190:17)
at Printf.template (/path/node_modules/koa2-winston/stringify_schema.js:204:21)
at Printf.transform (/path/node_modules/logform/printf.js:11:26)
at Format.transform (/path/node_modules/logform/combine.js:20:24)
at DerivedLogger._transform (/path/node_modules/winston/lib/winston/logger.js:305:29)
at DerivedLogger.Transform._read (/path/node_modules/winston/node_modules/readable-stream/lib/_stream_transform.js:177:10)
at DerivedLogger.Transform._write (/path/node_modules/winston/node_modules/readable-stream/lib/_stream_transform.js:164:83)
[ERROR] 14:09:39 TypeError: Cannot read property 'toString' of undefined
I ran into this because another middleware I'm using sets a header property and sometimes the value of that property is undefined. I did submit a PR to that middleware to omit the property when its value is undefined but koa2-winston should probably handle such cases without throwing an exception.
The text was updated successfully, but these errors were encountered:
If
req.header
contains a property whose value isundefined
then thekoa2-winston
logger raises an exception with a stack trace like this:I ran into this because another middleware I'm using sets a header property and sometimes the value of that property is
undefined
. I did submit a PR to that middleware to omit the property when its value isundefined
butkoa2-winston
should probably handle such cases without throwing an exception.The text was updated successfully, but these errors were encountered: