The src/package.json (the deployed lambda) pins sharp: ^0.31.3 (December 2022), while root devDependencies is on ^0.33.1. Tests run against a different Sharp than production. Sharp 0.33 is ESM-native, which makes the createCommonJS/require shim at the top of src/getOrCreateObject/resizeAndSave.js (and the mlly dependency that supports it) unnecessary.
Goals
- Bump src/package.json sharp to ^0.33.x
- Remove the mlly import and createCommonJS block in resizeAndSave.js
- Replace with a direct import sharp from 'sharp'
- Drop mlly from src/package.json dependencies if no longer referenced
- Verify sam build -u resolves the Linux native binary correctly (Sharp 0.33 changed its native-binary distribution to optional deps)
- npm test passes
The
src/package.json(the deployed lambda) pins sharp: ^0.31.3 (December 2022), while root devDependencies is on ^0.33.1. Tests run against a different Sharp than production. Sharp 0.33 is ESM-native, which makes the createCommonJS/require shim at the top of src/getOrCreateObject/resizeAndSave.js (and the mlly dependency that supports it) unnecessary.Goals