I setup a very basic test endpoint using CDK to build an API Gateway endpoint, proxied to a Lambda function integration. But it doesn’t work:
Can anyone spot the mistake? I am combing over the CDK Typescript tutorial and my example appears to model theirs. I made sure to run each of the following in terminal and follow the link given after the successful deploy:
cdk bootstrap
cdk synth
cdk deploy
// terminal feedback
✅ VoipCallTrackBackendStack
Outputs:
VoipCallTrackBackendStack.testApiEndpointC9D07ADA = https://ta84rhhguc.execute-api.us-east-2.amazonaws.com/prod/
Going into the web console for the newly created lambda function i see this:
Response:
{
“errorType”: “Runtime.ImportModuleError”,
“errorMessage”: “Error: Cannot find module ‘test’\nRequire stack:\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js”,
“trace”: [
“Runtime.ImportModuleError: Error: Cannot find module ‘test’”,
“Require stack:”,
“- /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. (/var/runtime/index.js:43:30)“,
" at Module._compile (internal/modules/cjs/loader.js:1133:30)”,
" at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)“,
" at Module.load (internal/modules/cjs/loader.js:977:32)”,
" at Function.Module._load (internal/modules/cjs/loader.js:877:14)“,
" at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)”,
" at internal/main/run_main_module.js:18:47"
]
}
Request ID:
"60f586cd-a397-4828-aaf8-c91506ed7abe"
Function logs:
START RequestId: 60f586cd-a397-4828-aaf8-c91506ed7abe Version: $LATEST
2020-08-02T15:33:27.622Z undefined ERROR Uncaught Exception {"errorType":"Runtime.ImportModuleError","errorMessage":"Error: Cannot find module 'test'\nRequire stack:\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js","stack":["Runtime.ImportModuleError: Error: Cannot find module 'test'","Require stack:","- /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:1133:30)"," at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)"," at Module.load (internal/modules/cjs/loader.js:977:32)"," at Function.Module._load (internal/modules/cjs/loader.js:877:14)"," at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)"," at internal/main/run_main_module.js:18:47"]}
END RequestId: 60f586cd-a397-4828-aaf8-c91506ed7abe
REPORT RequestId: 60f586cd-a397-4828-aaf8-c91506ed7abe Duration: 955.66 ms Billed Duration: 1000 ms Memory Size: 128 MB Max Memory Used: 14 MB
Unknown application error occurred
Runtime.ImportModuleError
