Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execution Error: Cannot find module 'uuid/v4 in typescript ApiLambdaCrudDynamoDBExample #369

Closed
tinynet opened this issue Nov 29, 2020 · 2 comments
Assignees
Labels
bug This issue is a bug. duplicate This issue is a duplicate. effort/small Small work item – less than a day of effort language/typescript Related to Typescript examples p1

Comments

@tinynet
Copy link

tinynet commented Nov 29, 2020

🐛 Bug Report

Error executing the create function in typescript/api-cors-lambda-crud-dynamodb project

What is the problem?

The RestApiCrudLambdaDynamoDB-createItem lambda function cannot be executed because cannot find module 'uuid/v4'.
The project deploys an API gateway integrated with lambda functions that execute simple CRUD on a DynamoDB table.

Reproduction Steps

Simply install, build, deploy, and test the function with API gateway:

  $ npm install
  $ npm run build
  $ cdk synth
  $ cdk deploy

When it's deployed, in the API gateway, test the POST method on /items/ resource. You can set body = {}

Verbose Log

From the lambda logs:

{
    "errorType": "Runtime.ImportModuleError",
    "errorMessage": "Error: Cannot find module 'uuid/v4'",
    "stack": [
        "Runtime.ImportModuleError: Error: Cannot find module 'uuid/v4'",
        "    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:45:30)",
        "    at Module._compile (internal/modules/cjs/loader.js:778:30)",
        "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)",
        "    at Module.load (internal/modules/cjs/loader.js:653:32)",
        "    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)",
        "    at Function.Module._load (internal/modules/cjs/loader.js:585:3)",
        "    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)",
        "    at startup (internal/bootstrap/node.js:283:19)"
    ]
}

Environment

Other information

It seems a known problem
But I could not make it work.
I changed the require statement as mentioned in SO, but same result:

const {"v4": uuidv4} = require('uuid');

Probably it will work uploading manually the module, but I'd like to solve it with cdk.

@tinynet tinynet added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 29, 2020
@SomayaB SomayaB added the language/typescript Related to Typescript examples label Nov 30, 2020
@NGL321 NGL321 added effort/small Small work item – less than a day of effort p1 duplicate This issue is a duplicate. and removed needs-triage This issue or PR still needs to be triaged. labels Jan 4, 2021
@NGL321
Copy link
Contributor

NGL321 commented Jan 4, 2021

Missed duplicate. This is a duplicate of #276

@NGL321 NGL321 closed this as completed Jan 4, 2021
@github-actions
Copy link

github-actions bot commented Jan 4, 2021

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. duplicate This issue is a duplicate. effort/small Small work item – less than a day of effort language/typescript Related to Typescript examples p1
Projects
None yet
Development

No branches or pull requests

3 participants