Unable to log a "request" event while using "response.failaction" settings as "log" instead of throwing an error.
See original GitHub issueHapi allows you to choose what to do when response validation fails by setting response.failAction. (ref.: https://hapijs.com/tutorials/validation#failaction)
When we set that option to:
the current way that hapi-pino
is set to log requests which have the event.channel
set to internal
doesn’t recognizes that configuration and the log message is ignored.
This is where Hapi check for the response.failAction settings
node_modules/@hapi/hapi/lib/toolkit.js
This is where Hapi creates a log payload using the internal channel
node_modules/@hapi/hapi/lib/request.js
This is where hapi-pino
is ignoring the log message:
node_modules/hapi-pino/index.js
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How to avoid Hapi.js sending 400 error when Validating ...
There are Two Simple Solutions: 1. Use server.ext('onPreResponse' ... As noted by @Clarkie a generic way of catching all errors in your Hapi ......
Read more >21.1.0 API Reference - hapi.dev
error () when the events are logged via server.log() as well as internally generated server logs. Defaults to no output. request - a...
Read more >pinojs - Bountysource
When I am starting the server I am seeing the error hapi-pino is already registered . ... Unable to log a "request" event...
Read more >Find errors & resume jobs with logs in AzCopy (Azure Storage)
When submitting a request to Microsoft Support (or troubleshooting the issue involving any third party), share the redacted version of the ...
Read more >Handling Joi validation errors in Hapi 17 | by Piotr Karpala
It's an object schema description language and validator for JavaScript objects. It hits all the checkmarks, it's easy to use, readable, fast ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If anyone else stumbles onto this, the following works to get these errors logged:
Would you like to send a Pull Request to address this issue? Remember to add unit tests.