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
I have a node-based project running as a linux Azure App Service (with Application Insights enabled).
In my application, when winston is initiated without a config object:
[INFO] _____
[INFO] / _ \ __________ _________ ____
[INFO] / /_\ \___ / | \_ __ \_/ __ \
[INFO] / | \/ /| | /| | \/\ ___/
[INFO] \____|__ /_____ \____/ |__| \___ >
[INFO] \/ \/ \/
[INFO] A P P S E R V I C E O N L I N U X
[INFO]
[INFO] Documentation: http://aka.ms/webapp-linux
[INFO] NodeJS quickstart: https://aka.ms/node-qs
[INFO] NodeJS Version : v16.8.0
[INFO]
[ERROR] /agents/node/node_modules/diagnostic-channel-publishers/dist/src/winston.pub.js:116
[ERROR] var levels = arguments[0].levels || originalWinston.config.npm.levels;
[ERROR] ^
[ERROR]
[ERROR] TypeError: Cannot read property 'levels' of undefined
[ERROR] at Object.patchedCreate [as createLogger] (/agents/node/node_modules/diagnostic-channel-publishers/dist/src/winston.pub.js:116:35)
[ERROR] at Object.<anonymous> (/home/site/wwwroot/server/utils/logger.js:19:24)
[ERROR] at Module._compile (node:internal/modules/cjs/loader:1101:14)
[ERROR] at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
[ERROR] at Module.load (node:internal/modules/cjs/loader:981:32)
[ERROR] at Function.Module._load (node:internal/modules/cjs/loader:822:12)
[ERROR] at Module.require (node:internal/modules/cjs/loader:1005:19)
[ERROR] at Module.patchedRequire [as require] (/agents/node/node_modules/diagnostic-channel/dist/src/patchRequire.js:15:46)
[ERROR] at require (node:internal/modules/cjs/helpers:94:18)
[ERROR] at Object.<anonymous> (/home/site/wwwroot/server/router/api.js:4:16)
[ERROR] npm info lifecycle [email protected]~start: Failed to exec start script
[ERROR] npm ERR! code ELIFECYCLE
[ERROR] npm ERR! errno 1
[ERROR] npm ERR! [email protected] start: `node server.js`
[ERROR] npm ERR! Exit status 1
[ERROR] npm ERR!
[ERROR] npm ERR! Failed at the [email protected] start script.
[ERROR] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
The text was updated successfully, but these errors were encountered:
phuze
changed the title
Winston: 'Cannot read property level of undefined' when Logger created without arguments
Winston: 'Cannot read property 'levels' of undefined' when Logger created without arguments
Apr 23, 2022
phuze
changed the title
Winston: 'Cannot read property 'levels' of undefined' when Logger created without arguments
Winston: "Cannot read property 'levels' of undefined" when Logger created without arguments
Apr 23, 2022
Seems to be related to #115 . I'm in favor of refactoring the Winston patch code a bit more. @microsoftopensource , would it be okay if I publish a PR for this?
I have a node-based project running as a linux Azure App Service (with Application Insights enabled).
In my application, when winston is initiated without a config object:
It fails:
Even though passing nothing is considered valid by Winston: https://github.com/winstonjs/winston/blob/master/index.d.ts#L184
Works correctly if empty object
{}
supplied as argument tocreateLogger
:The text was updated successfully, but these errors were encountered: