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.

[BUG] TypeError: (0 , pino_http_1.pinoHttp) is not a function

See original GitHub issue

[x] I’ve read the docs of nestjs-pino

[x] I’ve read the docs of pino

[x] I couldn’t find the same open issue of nestjs-pino

What is the current behavior? After upgrading to version 2.4.0, I get the following error when starting a nestjs project that was using nestjs-pino version 2.3.1 without issues.

/home/user/project/node_modules/nestjs-pino/LoggerModule.js:94
    const middleware = (0, pino_http_1.pinoHttp)(params);
                                                ^
TypeError: (0 , pino_http_1.pinoHttp) is not a function
    at createLoggerMiddlewares (/home/user/project/node_modules/nestjs-pino/LoggerModule.js:94:49)
    at LoggerModule.configure (/home/user/project/node_modules/nestjs-pino/LoggerModule.js:64:29)
    at MiddlewareModule.loadConfiguration (/home/user/project/node_modules/@nestjs/core/middleware/middleware-module.js:49:24)
    at loadMiddlewareConfiguration (/home/user/project/node_modules/@nestjs/core/middleware/middleware-module.js:38:24)
    at Array.map (<anonymous>)
    at MiddlewareModule.resolveMiddleware (/home/user/project/node_modules/@nestjs/core/middleware/middleware-module.js:41:41)
    at MiddlewareModule.register (/home/user/project/node_modules/@nestjs/core/middleware/middleware-module.js:33:20)
    at NestApplication.registerModules (/home/user/project/node_modules/@nestjs/core/nest-application.js:80:37)
    at NestApplication.init (/home/user/project/node_modules/@nestjs/core/nest-application.js:94:20)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

What is the expected behavior? The Nestjs project should start normally. No issues in previous version 2.3.1

Please provide minimal example repo. Without it this issue will be closed No time to provide a repo to reproduce. If this issue will be closed, I will just stick to 2.3.1. The issue should be easy to reproduce, however, as all you have to do if to only follow the Readme of this repo.

Please mention other relevant information such as Node.js version and Operating System. Node v16.13.0 Ubuntu 20.04 LTS under WSL 2

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
Loubiscommented, Dec 20, 2021

Had the same error today on Docker with node:14.16.0.

I solved it by updating the version of "nestjs-pino": "^2.2.0", -> "^2.4.0" and "pino-http": "^5.8.0", -> "^6.5.0" in the package.json.

0reactions
YFLooicommented, Sep 27, 2022

Had the same error today on Docker with node:14.16.0.

I solved it by updating the version of "nestjs-pino": "^2.2.0", -> "^2.4.0" and "pino-http": "^5.8.0", -> "^6.5.0" in the package.json.

Thanks @Loubis! "pino-http": "^6.5.0" works just fine with "nestjs-pino": "^2.2.0" as well. pino-http was missing the required Type.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pino is not a function - TypeScript · Issue #543 - GitHub
Hi!, i'm doing a migration of a project to TypeScript and it uses Pino.js but it says Pino is not a function.
Read more >
Setting Pino level gives me 'log_1.default.level is not a function'
I have set up a log utility module using Pino in a KeystoneJS/NodeJS project. It works fine, but I want to limit the...
Read more >
pino-http - npm
High-speed HTTP logger for Node.js. Latest version: 8.3.0, last published: 11 days ago. Start using pino-http in your project by running ...
Read more >
A Complete Guide to Pino Logging in Node.js - Better Stack
Learn how to start logging with Pino in Node.js and go from basics to best practices in no time.
Read more >
How to Implement Logging in a Node.js Application With Pino ...
But, this can create a little problem with this logger-service: the JSON log that you will see in a minute is not readable....
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