Lambda deployment error | AWS re:Post

Whenever I use curl to invoke my lambda function locally, I encounter the following issue. Even though I have aws-sdk imported.
My lambda code : index.js

curl -X POST -H “Content-Type: application/json” -d ‘{“input_text”: “Example text”, “input_file_path”: “s3://fullstackjun/identity.c”}’ v8ysb49d0b.execute-api.us-west-1.amazonaws.com/dev

Error:
{“errorType”:”Error”,”errorMessage”:”Cannot find package ‘aws-sdk’ imported from /var/task/index.mjs\nDid you mean to import aws-sdk/lib/aws.js?”,”trace”:[“Error [ERR_MODULE_NOT_FOUND]: Cannot find package ‘aws-sdk’ imported from /var/task/index.mjs”,”Did you mean to import aws-sdk/lib/aws.js?”,” at new NodeError (node:internal/errors:399:5)”,” at packageResolve (node:internal/modules/esm/resolve:894:9)”,” at moduleResolve (node:internal/modules/esm/resolve:987:20)”,” at moduleResolveWithNodePath (node:internal/modules/esm/resolve:938:12)”,” at defaultResolve (node:internal/modules/esm/resolve:1202:79)”,” at nextResolve (node:internal/modules/esm/loader:163:28)”,” at ESMLoader.resolve (node:internal/modules/esm/loader:838:30)”,” at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)”,” at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)”,” at link (node:internal/modules/esm/module_job:76:36)”]}%

Read more here: Source link