I have a similar experience. Although what I did was serverless, but I think the error is still relevant, because it also comes from AWS lambda. This is the error I saw:
Unable to import module 'src/handlers/list': Error at Function.Module._resolveFilename (module.js:469:15) at Function.Module._load (module.js:417:25) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Object.<anonymous> (/var/task/src/handlers/list.js:400:18) at __webpack_require__ (/var/task/src/handlers/list.js:20:30) at Object.<anonymous> (/var/task/src/handlers/list.js:370:18) at __webpack_require__ (/var/task/src/handlers/list.js:20:30) at /var/task/src/handlers/list.js:63:18 at Object.<anonymous> (/var/task/src/handlers/list.js:66:10)
I use webpack and I solved this by deleting the library in my webpack.config.js and the library name is self explanatory.
what I did was delete this line from webpack.config.js:
const nodeExternals = require("webpack-node-externals");
Please let me know if you need more information. thank you
source share