I created a project using sls create aws-nodejs-typescript. I modified the hello handler to receive a KiniesisStreamEvent. I also modified mock.json to be a sample Kinesis stream collection of records.
However when I run
sls invoke local -f hello -p src/functions/hello/mock.json
I get the following error:
{
"errorMessage": "Cannot read properties of undefined (reading 'Content-Type')",
"errorType": "TypeError",
"stackTrace": [
"TypeError: Cannot read properties of undefined (reading 'Content-Type')",
" at nextMiddleware (C:\\Projects\\GFL.Development\\gfl-lambdas-edip\\node_modules\\@middy\\http-json-body-parser\\index.js:14:29)",
" at runMiddlewares (C:\\Projects\\GFL.Development\\gfl-lambdas-edip\\node_modules\\@middy\\core\\index.js:119:27)",
" at runRequest (C:\\Projects\\GFL.Development\\gfl-lambdas-edip\\node_modules\\@middy\\core\\index.js:79:15)",
" at r (C:\\Projects\\GFL.Development\\gfl-lambdas-edip\\node_modules\\@middy\\core\\index.js:32:16)",
" at C:\\Projects\\GFL.Development\\gfl-lambdas-edip\\node_modules\\serverless\\lib\\plugins\\aws\\invoke-local\\index.js:953:30",
" at new Promise (<anonymous>)",
" at AwsInvokeLocal.invokeLocalNodeJs (C:\\Projects\\GFL.Development\\gfl-lambdas-edip\\node_modules\\serverless\\lib\\plugins\\aws\\invoke-local\\index.js:906:12)",
" at processTicksAndRejections (node:internal/process/task_queues:95:5)"
]
}
Not sure if maybe this is not supposed to work locally or I’m missing something.
Thank you,