TypeError: pretty is not a function
When running hapi-pino with prettyPrint enabled, I get the following error:
TypeError: pretty is not a function
at Object.write (node_modules/pino/lib/tools.js:282:25)
at Pino.write (node_modules/pino/lib/proto.js:177:15)
at Pino.LOG [as error] (node_modules/pino/lib/tools.js:55:21)
at Object.listener (node_modules/hapi-pino/index.js:138:22)
at Object.<anonymous>.module.exports.internals.Podium.emit (node_modules/@hapi/podium/lib/index.js:221:110)
at Request._log (node_modules/@hapi/hapi/lib/request.js:611:27)
at Request._finalize (node_modules/@hapi/hapi/lib/request.js:504:22)
at Request._reply (node_modules/@hapi/hapi/lib/request.js:460:14)
Configuration of the plugin is as follows:
{
plugin: 'hapi-pino',
options: { level: 'error', logPayload: true, prettyPrint: true }
}
Running:
hapi-pino 8.4.0
pino 6.11.3
pino-pretty 7.0.1
hapi 20.2.0
Not sure if this is a bug in hapi-pino or pino-pretty, so if it is in fact a bug in pino-pretty you can close this issue!
There is probably a bug somewhere in this module. I see it depends on pino-pretty and it probably shouldn't.
Unfortunately I have no time to dig deep, so a PR fixing it would be appreciated.
@Boelensman1 I don't have this issue on a brand new hapi 20.2.0 and hapi-pino 8.5.0.
I see you posted pino-pretty version of 7.0.1. You don't need to install it separately, it's part of hapi-pino (though pinned to pino-pretty ^4.0.0)
Just npm install @hapi/hapi hapi-pino and you're good to go.