Lmbda in CDK v2 project typescript giving error ->Runtime.ImportModuleError

0

The error goes like that : {"errorType":"Runtime.ImportModuleError","errorMessage":"Error: Cannot find module 'hellolambdafnfirst'\nRequire stack:\n- /var/runtime/index.mjs","trace":["Runtime.ImportModuleError: Error: Cannot find module 'hellolambdafnfirst'","Require stack:","- /var/runtime/index.mjs"," at _loadUserApp (file:///var/runtime/index.mjs:726:17)"," at async Object.module.exports.load (file:///var/runtime/index.mjs:741:21)"," at async file:///var/runtime/index.mjs:781:15"," at async file:///var/runtime/index.mjs:4:1"]}

Stack goes like that : very basic stack

 const lmbdafromcode = new lambda.Function(this, 'lmbdafromcodeName', {
            runtime: lambda.Runtime.NODEJS_16_X,
            handler: 'hellolambdafnfirst.handler',//filenameoflmnda (.) then handlername..export.handlername
            **code: lambda.Code.fromAsset(path.join(__dirname, '/../lmdaFun')),**
            memorySize: 1024,
        });

project starucure is simple like that

bin lib |-------------------HelloCdkStack.ts lmdaFun |-------------------hellolambdafnfirst.ts node_modules

1回答
0

I like to use entry : as seen here

profile pictureAWS
回答済み 2年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ