Skip to content

Updating Nodejs, causing error in Lambda function #40

@kram2912

Description

@kram2912

I was forced to update the node.js version, due to getting an error message saying that Lambda no longer supported the version referenced on this repository. Updated to version 22. When testing the Lambda on AWS I am getting the error included below. I am not a java dev so I would welcome updated app.js / package.json with corrected syntax.

Response:
{
"errorType": "Runtime.ImportModuleError",
"errorMessage": "Error: Cannot find module 'aws-sdk'\nRequire stack:\n- /var/task/app.js\n- /var/runtime/index.mjs",
"trace": [
"Runtime.ImportModuleError: Error: Cannot find module 'aws-sdk'",
"Require stack:",
"- /var/task/app.js",
"- /var/runtime/index.mjs",
" at _loadUserApp (file:///var/runtime/index.mjs:1087:17)",
" at async UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1119:21)",
" at async start (file:///var/runtime/index.mjs:1282:23)",
" at async file:///var/runtime/index.mjs:1288:1"
]
}

Function Logs:
2025-05-15T10:45:12.017Z undefined ERROR Uncaught Exception {"errorType":"Runtime.ImportModuleError","errorMessage":"Error: Cannot find module 'aws-sdk'\nRequire stack:\n- /var/task/app.js\n- /var/runtime/index.mjs","stack":["Runtime.ImportModuleError: Error: Cannot find module 'aws-sdk'","Require stack:","- /var/task/app.js","- /var/runtime/index.mjs"," at _loadUserApp (file:///var/runtime/index.mjs:1087:17)"," at async UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1119:21)"," at async start (file:///var/runtime/index.mjs:1282:23)"," at async file:///var/runtime/index.mjs:1288:1"]}
INIT_REPORT Init Duration: 86.51 ms Phase: invoke Status: error Error Type: Runtime.ImportModuleError
START RequestId: edaec6c5-fd34-41e5-b865-a3d85ceb52b9 Version: $LATEST
END RequestId: edaec6c5-fd34-41e5-b865-a3d85ceb52b9
REPORT RequestId: edaec6c5-fd34-41e5-b865-a3d85ceb52b9 Duration: 98.20 ms Billed Duration: 99 ms Memory Size: 128 MB Max Memory Used: 75 MB Status: error Error Type: Runtime.ImportModuleError

Request ID: edaec6c5-fd34-41e5-b865-a3d85ceb52b9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions