Skip to content

Function no longer works - out of date nodejs / aws-sdk #18

Description

@Hecatron

I think the version of aws-sdk and nodejs used in this setup are no longer supported by aws

From the looks of things nodejs16 went end of life at around July this year
https://aws.amazon.com/blogs/developer/announcing-the-end-of-support-for-node-js-16-x-in-the-aws-sdk-for-javascript-v3/

Currently trying to see if there are any workarounds
https://stackoverflow.com/questions/74549995/error-cannot-find-module-aws-sdk-in-nodejs-aws-lambda-function

Status: Failed
Test Event Name: (unsaved) test event

Response:
{
  "errorType": "Runtime.UnhandledPromiseRejection",
  "errorMessage": "Error: Cannot find module 'aws-sdk'\nRequire stack:\n- /var/task/monitor.js\n- /var/task/index.js\n- /var/runtime/index.mjs",
  "trace": [
    "Runtime.UnhandledPromiseRejection: Error: Cannot find module 'aws-sdk'",
    "Require stack:",
    "- /var/task/monitor.js",
    "- /var/task/index.js",
    "- /var/runtime/index.mjs",
    "    at process.<anonymous> (file:///var/runtime/index.mjs:1276:17)",
    "    at process.emit (node:events:517:28)",
    "    at emit (node:internal/process/promises:149:20)",
    "    at processPromiseRejections (node:internal/process/promises:283:27)",
    "    at process.processTicksAndRejections (node:internal/process/task_queues:96:32)"
  ]
}

Function Logs:
START RequestId: 8aa41ba5-1988-472a-9f4b-ee51e6ac6d69 Version: $LATEST
2024-11-12T13:40:46.133Z	8aa41ba5-1988-472a-9f4b-ee51e6ac6d69	INFO	calling monitor script.
2024-11-12T13:40:46.166Z	8aa41ba5-1988-472a-9f4b-ee51e6ac6d69	ERROR	Unhandled Promise Rejection 	{"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"Error: Cannot find module 'aws-sdk'\nRequire stack:\n- /var/task/monitor.js\n- /var/task/index.js\n- /var/runtime/index.mjs","reason":{"errorType":"Error","errorMessage":"Cannot find module 'aws-sdk'\nRequire stack:\n- /var/task/monitor.js\n- /var/task/index.js\n- /var/runtime/index.mjs","code":"MODULE_NOT_FOUND","requireStack":["/var/task/monitor.js","/var/task/index.js","/var/runtime/index.mjs"],"stack":["Error: Cannot find module 'aws-sdk'","Require stack:","- /var/task/monitor.js","- /var/task/index.js","- /var/runtime/index.mjs","    at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)","    at Module._load (node:internal/modules/cjs/loader:981:27)","    at Module.require (node:internal/modules/cjs/loader:1231:19)","    at require (node:internal/modules/helpers:177:18)","    at exports.handler (/var/task/monitor.js:69:17)","    at Runtime.index [as handler] (/var/task/index.js:42:24)","    at Runtime.handleOnceNonStreaming (file:///var/runtime/index.mjs:1173:29)"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: Error: Cannot find module 'aws-sdk'","Require stack:","- /var/task/monitor.js","- /var/task/index.js","- /var/runtime/index.mjs","    at process.<anonymous> (file:///var/runtime/index.mjs:1276:17)","    at process.emit (node:events:517:28)","    at emit (node:internal/process/promises:149:20)","    at processPromiseRejections (node:internal/process/promises:283:27)","    at process.processTicksAndRejections (node:internal/process/task_queues:96:32)"]}
Unknown application error occurred
Runtime.Unknown
END RequestId: 8aa41ba5-1988-472a-9f4b-ee51e6ac6d69
REPORT RequestId: 8aa41ba5-1988-472a-9f4b-ee51e6ac6d69	Duration: 114.61 ms	Billed Duration: 115 ms	Memory Size: 128 MB	Max Memory Used: 68 MB	Init Duration: 138.33 ms

Request ID: 8aa41ba5-1988-472a-9f4b-ee51e6ac6d69

It might be an idea to list this as no longer supported in the docs if the code isn't going to be updated
https://docs.fortinet.com/document/fortigate-public-cloud/7.6.0/aws-administration-guide/585081/creating-the-lambda-function

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions