I'm trying to query a DynamoDB table from a Lambda function (for an Alexa skill), but when I send the intent that calls require('aws-sdk')
, the skill seems to hang and timeout. The Alexa test page just says "There was a problem with the requested skill's response", and I don't see any errors in the CloudWatch logs. I have the skill set up to catch any errors and return them as a spoken response, so I'm sure it's not an uncaught exception. I've also tried wrapping the require
in a try/catch
block, but that didn't work either.
This is the module that gets loaded with require
if the test database intent request is received:
const AWS = require('aws-sdk');
module.exports = () => {
return 'Success!';
};
If I comment out require('aws-sdk')
, the function works properly and Alexa responds with "Success".
Why does my skill break when all I'm doing is requiring the aws-sdk
module?
I'm very new to AWS and this is my first experience trying to access a DynamoDB table in a Lambda function.
The Lambda function is uploaded as a zip that contains my source code, package.json (that includes aws-sdk
as a dependency), and the node_modules
folder.
aws-sdk
module. I do remember that DynamoDB was causing problems because the initial connection would sometimes take so long the function would timeout. – Discard