Closed CosmicDevs closed 5 years ago
Yah, documentation is a bit weak. Sorry. This was for a hackathon and is meant to be deployed from the serverless app repository which is an option when you choose to create a new lambda function.
That error is probably indicating the Lambda function broke in some way.
The lines you have posted above: "const tableName = process.env.LexLog;" and "const primaryKey = process.env.LexLogId;" won't work because you are referencing environmental variables named "LexLog" and "LexLogId" you probably didn't set in the Lambda console for your function. Either change the lines back the way they were and set the correct environmental variables for "PRIMARY_KEY" and "TABLE_NAME" in your Lambda function's console config or comment out the "process.env" lines entirely and hard code the values like this:
const tableName = 'LexLog'; const primaryKey = 'LexLogId';
Assuming "LexLog" is the name of your DynamoDB table and "LexLogId" is the name of your DynamoDB table primary key.
If you are still getting your error, try adding...
console.log("got here!")
...to your code to help debug and see how far your are getting.
In case your are new to Lambda functions: anything you console.log will show up in AWS Cloudwatch assuming the Lambda function is executing under a role that allows it to write to Cloudwatch. I think there is a built-in role like lambda-basic-execution or something. You can set the role in the Lambda function under "Execution role" in the AWS Lambda console. Once that is working, go to the AWS Cloudwatch console, click "Logs", select the /aws/lambda/{yourfunctionname} log, click "Search Log Group" and then I usually filter on the last five minutes of logs by clicking on "5m" in the upper right.
If you are still stuck let me know.
-Mark
Hi Mark,
This looks really useful for my project but I'm struggling to get it working as I'm not clear from the readme what lines in the index.js need updating and in what format.
I've updated lines 6, 8 and 31 with my info but when I invoke the Lambda from my bot I get: "An error has occurred: Invalid Lambda Response: Received error response from Lambda: Handled"
Updated Lambda index.js below if that helps.
Any help would be appreciated.