FormidableLabs / pino-lambda

Send pino logs to cloudwatch with aws-lambda
MIT License
125 stars 13 forks source link

Doesn't work with buffered logging when multiple JSONs could be put into on chunk separated by newline #54

Open mifopen opened 2 months ago

mifopen commented 2 months ago

Is there an existing issue for this?

Code of Conduct

Code Sandbox link

No response

Bug report

I would suggest to convert the library to pino transport using https://github.com/pinojs/pino-abstract-transport. Now it is very easy to crash a lambda after `JSON.parse` in the destination.ts is trying to parse a chunk containing smth like

{...}\n{...}
carbonrobot commented 2 months ago

@mifopen Thanks for the issue report, do you have a cope example we can build a test around?

We built this solution in collaboration with the Pino maintainers, but its been a couple years so I can circle back and see if this is still the preferred method.