When these following conditions happen:
- using pino for logging
type=modulein package.json- using TS with a target resulting in ESM code
running serverless package will package pino code that uses dynamic require for node:os, resulting in runtime error of packaged code:
Error: Dynamic require of \"node:os\" is not supported
I personally do not believe this is pino issue, but rather something up with packaging. Why? I can use pino just fine if I package everything myself (ie zip -r lambda.zip dist node_modules package.json).
Which brings me to another issue: even when I include custom artifact in serverless.yml (serverless.yml Reference - Serverless Framework - AWS Lambda Guide - Serverless.yml Reference) serverless still does the packaging, ignoring the zip file ![]()
[EDIT]
Ignore the second issue, I started the custom artifact path with ./. After removing this serverless behaves as expected.