Unfortunately AWS support has confirmed we can't utilize layers with ES:
importing ESM modules from layers seems to not be supported when using a module type in Lambda. [...] this is a Node feature blocking us to import ES modules from a layer as "NODE_PATH" variable is not supported by the ESM loader in node
Disappointing that AWS is making headway on supporting ES, but it means we lose the functionality of layers. Support provided a wrapper workaround that we'll be trying. It corresponds with what we found here. Hopefully this saves someone else the headache we've gone through the last week.
Is this still the case with node18.x???
- Accepted Answerasked 2 years ago
- How do I resolve the "Cannot find module" or "Cannot find Package" errors when I run Lambda code in Node.js?AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated 9 months ago
- AWS OFFICIALUpdated 2 years ago
- EXPERTpublished 2 months ago
- EXPERTpublished 7 months ago