"errorType": "Runtime.ImportModuleError" for uuid module

756 views Asked by At

I have been trying to build an application using Polly, s3, and lambda using Angular. On testing the lambda function, I got an error stating this:

{
  "errorType": "Runtime.ImportModuleError",
  "errorMessage": "Error: Cannot find module 'uuid/v1'\nRequire stack:\n- /var/task/handler.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js",
  "trace": [
    "Runtime.ImportModuleError: Error: Cannot find module 'uuid/v1'",
    "Require stack:",
    "- /var/task/handler.js",
    "- /var/runtime/UserFunction.js",
    "- /var/runtime/index.js",
    "    at _loadUserApp (/var/runtime/UserFunction.js:100:13)",
    "    at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)",
    "    at Object.<anonymous> (/var/runtime/index.js:43:30)",
    "    at Module._compile (internal/modules/cjs/loader.js:1137:30)",
    "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)",
    "    at Module.load (internal/modules/cjs/loader.js:985:32)",
    "    at Function.Module._load (internal/modules/cjs/loader.js:878:14)",
    "    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)",
    "    at internal/main/run_main_module.js:17:47"
  ]
}
1

There are 1 answers

0
AudioBubble On

You need to create a ZIP archive that contains your function code and dependencies. You need to create a deployment package if you use the Lambda API to manage functions, or if you need to include libraries and dependencies other than the AWS SDK.

If your function depends on libraries other than the SDK for JavaScript, install them to a local directory with NPM, and include them in your deployment package. You can also include the SDK for JavaScript if you need a newer version than the one included on the runtime, or to ensure that the version doesn't change in the future. If the deployment package is larger than 50 MB, you must use Amazon S3.

Running Arbitrary Executables in AWS Lambda
Using Packages and Native nodejs Modules in AWS Lambda