question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

self._addDefaultMeta is not a function error still occurs with 3.2.1

See original GitHub issue

Please tell us about your environment:

  • winston version?
    • winston@2
    • winston@3
  • node -v outputs: 11.6.0
  • Operating System? OSX
  • Language? ES6/7

What is the problem?

Seems like #1579 did not fully fix the _addDefaultMeta bug. After upgrading to winston 3.2.1 I still get this error in my app at https://github.com/winstonjs/winston/blob/efd7baf65da13edaba7829aa4339757eed4322eb/lib/winston/create-logger.js#L80

Full stack trace:

TypeError: self._addDefaultMeta is not a function
  at Object.DerivedLogger.(anonymous function) [as log] (/path/to/project/node_modules/winston/lib/winston/create-logger.js:80:14)
  at module.exports.<anonymous> (/path/to/project/node_modules/sequelize-fixtures/lib/writer.js:39:16)
  at module.exports.tryCatcher (/path/to/project/node_modules/bluebird/js/release/util.js:16:23)
  at module.exports.writeFile (/path/to/project/node_modules/bluebird/js/release/method.js:15:34)
  at updateReferences (/path/to/project/services/sample_data/index.js:919:6)
  at Object.import (/path/to/project/services/sample_data/index.js:961:13)

What do you expect to happen instead?

That my app does not crash with the above error

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

21reactions
tizmagikcommented, Nov 18, 2019

Another way I found that works is to bind:

const logHelper = {
  log: logger.info.bind(logger)
};
4reactions
indexzerocommented, Jan 31, 2019

Thanks for reporting this bug, but yes: the failure is by design. If you would like to create another object with it’s own properties that is still a logger, use Object.create (logger, extraProps)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error after update winston to version 3.2.1. TypeError: self ...
TypeError: self. ... After I updated winston to version 3.2.1, I get an error while trying ... _addDefaultMeta is not a function at...
Read more >
Uncaught TypeError | Is Not A Function | Solution - YouTube
Have you encountered an error like:- Uncaught TypeError- Some selector is not a function - jQuery is not a function - owlCarousel is...
Read more >
[h3] [unhandled] H3Error: __vite_ssr_import_0__.defineStore ...
When installing the "pinia" package via npm i pinia , I got a bunch of errors, similar to what's described here. This seems...
Read more >
Error after update winston to version 3.2.1. TypeError: self ... - Quabr
D:\Dev\MyProjectName\node_modules\winston\lib\winston\create-logger.js:80 self._addDefaultMeta(info); ^ TypeError: self._addDefaultMeta is not a function at ...
Read more >
Error After Update Winston To Version 3.2.1 ... - TutorialMeta
Error After Update Winston To Version 3.2.1. TypeError: Self._addDefaultMeta Is Not A Function. node.js logging webpack winston. 27 October 2019 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found