I am trying to call adminInitiateAuth as follows:
var params = {
AuthFlow: 'ADMIN_NO_SRP_AUTH',
ClientId: 'xxxxxxxxx',
UserPoolId: 'eu-west-1_xxxxxx',
AuthParameters: {
email: email,
password: password
}
};
var cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider({apiVersion: '2016-04-18'});
cognitoidentityserviceprovider.adminInitiateAuth(params, function(err, data) {
if (err) {
console.log(err, err.stack);
} else {
console.log(data);
}
});
But I am getting the following error:
TypeError: cognitoidentityserviceprovider.adminInitiateAuth is not a function
Any ideas what I am doing wrong here? Other functions such as signUp work when called in the same manner!
AWS Lambda setup: create layer to interact with webhooks - Snyk User Docs. The example code for Create Lambda function to connect Snyk to Slack uses axios to interact with the Slack webhooks. Therefore you must add a layer to the new AWS Lambda function to be able to use axios.
To integrate the latest version of an AWS SDK into your Lambda function's deployment package, create a Lambda layer, and then add it to your function. You can use either the AWS Command Line Interface (AWS CLI) or the Lambda console to create a Lambda layer and add it to your function.
Access your IAM Management console and select Roles from the left menu. Click Create role and select the AWS Service Lambda role. Once both are highlighted, click Next: Permissions. Name your role whatever you want, as long as it's recognizable to you, and click Create role.
Best practices suggest that one separate the handler from the Lambda's core logic. Not only is it okay to add additional definitions, it can lead to more legible code and reduce waste--e.g. multiple API calls to S3.
I've been looking into this as well and it appears that the NodeJS AWS sdk that is being provided for the Lambda functions is version 2.4.9, you can check by running:
console.log('SDK Version is ' + AWS.VERSION)
The version that was released with adminInitiateAuth is version 2.4.11. I assume that Amazon will update their lambda machines soon but in the meantime you could try adding adding the new sdk manually by
npm install aws-sdk
and then zipping up your lambda file with the node_modules folder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With