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.

cls-rtracer causes pino-http >= version 7.1 to log success message (responses) twice

See original GitHub issue

When the cls-rtracer middleware is added before a logging middleware based on pino-http >= 7.1.0 the success messages (responses) are logged twice.

The problem happens since the merge of this PR in pino-http: https://github.com/pinojs/pino-http/pull/219 So after this response event listener was added: res.on('close', onResFinished) in addition to the already existing one res.on('finish', onResFinished)

For further reference please check the rejected issue at pino-http: https://github.com/pinojs/pino-http/issues/234 and the sample app to reproduce the issue provided by @Simon-Campbell : https://github.com/Simon-Campbell/pino-http-double-success

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
puzpuzpuzcommented, Jul 3, 2022

Yup, that’s right. I’m looking into it to provide a proper fix. Just wanted to share a workaround.

1reaction
holzerchcommented, Jul 4, 2022

Thanks a lot for the very fast fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Log formatter getting called twice - intentional? #866 - GitHub
I'm mutating the object being logged (should I not be?) and it's causing some unexpected output. The text was updated successfully, but these ......
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