Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
TypeError: winston.transports.Loggly is not a constructor #26
Conversation
|
@mdemri can you offer more details about what error you found with Winston 2.4? |
|
Code: if (condition) { Output: TypeError: winston.transports.Loggly is not a constructor |
|
Okay thanks we will have an engineer take a look at this in the next couple weeks |
|
Weeks? It's an unprofessional behavior. |
|
Sorry we'd like to test it to confirm the bug or at least confirm others are affected, especially since minor version updates are supposed to be backwards compatible. We run sprints and it's at the top of our backlog. There are a few issues ahead of this one. If you get to it before us, we'd be grateful for a PR that fixes the issue as well. |
|
@mdemri, I tried your sample code at my end to reproduce the issue mentioned by you but couldn't see any error. Can you please verify the below steps at your end to confirm that we both are following the same standard instructions for node logging.
I tested the code with winston version 2.4.0 and 2.3.1, node-loggly-bulk version 2.0.1 and 2.0.2, winston-loggly-bulk version 2.0.1, node version 6.10.1 and everything worked fine for me, my event also reached to Loggly successfully. FYI- The error TypeError: winston.transports.Loggly is not a constructor may also occur if the module winston-loggly-bulk couldn't be loaded in your project for any reason and is undefined. Please try the above steps and see if this resolve your issue? cc: @mostlyjason |
|
I'm also experiencing this error with winston |
|
Thanks @adambiggs! @Shwetajain148 can you test these versions? |
|
@adambiggs I tested with winston 2.4.0, winston-loggly-bulk 2.0.1 in node 8.7.0 and 8.6.0 but couldn't see any error at my end. It would be great if you can offer your reproducible code to me so that I can look at the issue since I am not able to reproduce this error at my end. cc: @mostlyjason |
|
Sorry @Shwetajain148, we've moved away from this package and I don't have time to look into it any further... But if it makes any difference I was using Yarn to install dependencies when I noticed the issue. |
|
@adambiggs @mdemri I have tried in the ways provided by you(including Yarn) but couldn't reproduce this error on my end. If you ever come across with the reproducible code for this error in future please share it with me with the environment details, I will be happy to fix the issue. Thanks. |
|
@jimdubbs in your travisci environment, can you check the package lock or logs to see if the modules for winston-loggly-bulk and the dependency node-loggly-bulk were loaded? Also, which node version is it running? |
|
This issue still occurs. I'm using node version 8.9.0, winston 2.4.0, winston-loggly-bulk 2.0.1 |
|
@mbesnili can you paste your error message? Is it "winston.transports.Loggly is not a constructor"? Also, can you paste the code you are using to construct the loggly transport? |
|
Hi, i have the same error using the lib in node-red. When i use the next statement it works but i need the var to do a .remove at the end. Is there a workaround? this is my code: var require = global.get('require'); var winston = require('winston'); var loggly = new winston.transports.Loggly({ winston.add(loggly); winston.log('info',"Hello World from Node.js!"); return msg; |
|
Hi @mdemri @adambiggs @mbesnili can you please let me know the npm version you are running in your setup? It may possible that you are running an old version of npm which is causing this issue to you? |
|
I'm on npm version 3.10.10
I will update to the newest version and inform you.
Van: "Shwetajain148" <notifications@github.com>
Aan: "loggly/winston-loggly-bulk" <winston-loggly-bulk@noreply.github.com>
Cc: "Ruben Desmet" <ruben.desmet@telenet.be>, "Comment" <comment@noreply.github.com>
Verzonden: Woensdag 29 november 2017 13:45:32
Onderwerp: Re: [loggly/winston-loggly-bulk] don't take latest version of winston (#26)
Hi [ https://github.com/mdemri | @mdemri ] [ https://github.com/adambiggs | @adambiggs ] [ https://github.com/mbesnili | @mbesnili ] can you please let me know the npm version you are running in your setup? It may possible that you are running an old version of npm which is causing this issue to you?
—
You are receiving this because you commented.
Reply to this email directly, [ #26 (comment) | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/Afjjy3hs--2mx30-q3K8F-YMDUJl115Jks5s7VHsgaJpZM4PsrBv | mute the thread ] .
|
|
@Rubinski78 I was able to reproduce the error reported by you if I follow your exact code. So what happening here is that if you are creating the Loggly transporter using the new keyword and storing it into a variable(to do Ref- https://github.com/winstonjs/winston/blob/2.4.0/lib/winston/logger.js#L481 Please follow the below code that should works for you and if not then let me know.
Also, please note that if you are using the |
|
Hey guys we have updated our documentation to explain using the new keyword, and we've also created a troubleshooting step addressing the error message: https://www.loggly.com/docs/node-js-logs/. Since we haven't seen any additional reports since describing the fix, I'm going to close this issue for now. Please reopen it if you experience the issue after implementing Shweta's solution. |
Taking winston 2.4.0 doesn't work, so don't