[QUESTION] Middleware binding on graphql requests?
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 question about nestjs-pino
Question
I saw it mentioned in this issue that the module should work on graphql requests, however, as far as I can tell, middleware applied via MiddlewareConsumer
is not executed when using the nestjs/graphql module. While the logger will work, there is no instance bound to the request from asynclocalstorage, and using the assign
method result in an error being thrown.
Is my understanding incorrect? Does something special need to be done to get this functional on graphql requests? I’m thinking the bindLoggerMiddleware
needs to be exposed so it can be bound by the graphql context.
Please mention other relevant information such as Node.js version and Operating System.
n/a
Issue Analytics
- State:
- Created 2 years ago
- Comments:18 (6 by maintainers)
Top GitHub Comments
@julestruong if you need such info you have to use plugins. Here is the reference from my current project:
also I recommend add to config:
@julestruong current plugin will work pretty the same as autologging, but with your custom data. It’s just to prevent log duplication, but it’s up to you