I am trying to initialize a lambda client inside a nodejs code. When calling the lambda constructor I am getting an error.
I am executing:
var aws = require('aws-sdk');
aws.config.update({region: 'us-east-1'});
var lambda = new aws.Lambda({region: 'us-east-1', apiVersion: '2015-03-31'});
This last line throws the following exception:
Error: Could not find API configuration lambda-2015-03-31
at Runtime.requireModule
at Runtime.requireModuleOrMock
at Object.get [as 2015-03-31]
The environment variables are correctly configured. I am also doing some DynamoDB operations and everything works ok.
I followed the AWS documentation: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Lambda.html
I have also checked the service status (it's ok): https://status.aws.amazon.com/