Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] NestJS with Fastify : response headers are empty #860

Open
remija opened this issue Mar 14, 2022 · 3 comments
Open

[BUG] NestJS with Fastify : response headers are empty #860

remija opened this issue Mar 14, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@remija
Copy link

remija commented Mar 14, 2022

[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?

HTTP log messages return an empty Response Headers object when using the library as part of a NestJS application with the Fastify platform, unlike the default Express platform.

Example:

  • NestJS with Fastify
    {"level":30,"time":1647270615012,"pid":46872,"hostname":"MacBook-Pro.local","req":{"id":"req-2","method":"POST","url":"/v0/test-post","query":{},"headers":{"content-type":"application/json","user-agent":"PostmanRuntime/7.28.4","accept":"/","postman-token":"cc8db335-488b-4741-966a-87b09cb96951","host":"localhost:3000","accept-encoding":"gzip, deflate, br","connection":"keep-alive","content-length":"69"},"remoteAddress":"127.0.0.1","remotePort":51821},"res":{"statusCode":201,"headers":{}},"responseTime":7,"msg":"request completed"}

  • NestJS with Express
    {"level":30,"time":1647270754658,"pid":46900,"hostname":"MacBook-Pro.local","req":{"id":1,"method":"POST","url":"/v0/test-post","query":{},"params":{"0":"v0/test-post/remi"},"headers":{"content-type":"application/json","user-agent":"PostmanRuntime/7.28.4","accept":"/","postman-token":"7803653a-bbd3-4e7b-8733-37d59bfc0276","host":"localhost:3000","accept-encoding":"gzip, deflate, br","connection":"keep-alive","content-length":"69"},"remoteAddress":"127.0.0.1","remotePort":51829},"res":{"statusCode":201,"headers":{"x-powered-by":"Express","content-type":"application/json; charset=utf-8","content-length":"30","etag":"W/"1e-ZljF/Nt5uArBAuXc8XriunP0mGg""}},"responseTime":5,"msg":"request completed"}

What is the expected behavior?

The Response Headers must be filled in NestJS with Fastify case.

Please provide minimal example repo. Without it this issue will be closed

Please mention other relevant information such as Node.js version and Operating System.

NodeJS 14.18.1
NestJS 8.4.1 (latest, same result with other 8 versions)
nest-pino 2.5.0

Otherwise very good work, thank you ;)

@remija remija added the bug Something isn't working label Mar 14, 2022
@antonbarada
Copy link

+1

@jongomes
Copy link

req.user not work too.

@johaven
Copy link

johaven commented Nov 25, 2023

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants