When i'm trying to use cognito.adminSetUserPassword in aws lambda the console says: cognito.adminSetUserPassword is not a function but when i'm trying in localhost its works fine. The current code is the follow y nodejs with express.
module.exports.set_password = async (req, res) => {
try {
const cognito = new AWS.CognitoIdentityServiceProvider({
region: process.env.AWS_REGION,
});
const { id: Username } = req.params;
const newPassword = 'newPassword@12333'
await cognito.adminSetUserPassword({
UserPoolId: process.env.USERPOOL_ID,
Username,
Password: newPassword,
Permanent: false,
}).promise();
} catch (error) {
console.log(error);
res.status(error.code).json({
code: error.code,
message: error.message,
});
}
};