Bug with AWS sam nodejs esm and local layers.
Example shows a local layer nanoid, and two lambda functions with identical code just different module type.
# install local layer
cd nanoid/nodejs
npm install
sam local invoke CJSFunction
sam local invoke ESMFunction
Both functions should perform the same task and return the string hello <random-string>
.
Common JS version works while the ESM version throws an error - Cannot find package 'nanoid'