AWS Lambda
Runtime.ImportModuleError: Error: Cannot find module
Lambda can't load a dependency your handler imports — most often after a runtime upgrade changed what's bundled.
Common right after changing the runtime: (1) on nodejs18+ the AWS SDK v2 ('aws-sdk') is no longer preinstalled — only @aws-sdk v3 is; (2) a bundler (esbuild >= 0.22) now omits node_modules from the bundle by default; (3) a Lambda layer was built on a different OS/arch than the runtime; (4) a native binary needs a different glibc. The handler then throws ImportModuleError at cold start.
Related deadline: Lambda Node.js 18 EOL — 2027-02-01.
The free EOLkits scanner runs in your browser (nothing uploaded) and flags this and related breakages across your IaC and dependency files.
Primary source: https://repost.aws/knowledge-center/lambda-import-module-error-nodejs