aws-sdk

AWS Cognito Mock

一曲冷凌霜 提交于 2020-12-08 06:10:37
问题 I want to write BDD tests for my nodejs based API which uses AWS cognito as user authentication service, but I don't want to hit the real cognito service every time my build runs. Is there an easy and elegant way to mock Cognito calls. Used frameworks : Nodejs (Hapi.js) aws-sdk for nodejs 回答1: We have created an aws-sdk-mock npm module which mocks out all the AWS SDK services and methods. https://github.com/dwyl/aws-sdk-mock It's really easy to use. Just call AWS.mock with the service, method

Node JS + AWS Promise Triggered Twice

你离开我真会死。 提交于 2020-12-03 11:35:32
问题 AWS = require('aws-sdk'); AWS.config.region = 'eu-west-1'; ses = new AWS.SES(); var params = {}; return ses.sendEmail(params, function (err, data) { console.log('----->sending email') }).promise().then((data) => { console.log('---->sending promise') }).catch((err) => { console.log('----->am in error') console.log(err) }) Can someone help my above code promise is triggered twice. I should get below ----->sending email ---->sending promise But i got ----->sending email ---->sending promise ----

AWS Lambda invoke function (js sdk): timeout resets to default

一世执手 提交于 2020-12-03 07:51:55
问题 I am running a Meteor (Node 4.4.7) application that performs long operations on AWS Lambda. I invoke the lambda function from my code and wait for the response before proceeding to the next invocation. I set the timeout to 300000ms as described in a former question (both on Lambda and in the AWS.Lambda object in my code). My problem is that sometimes the AWS.Lambda timeout value is reset to the default value of 120000ms. As my Lambda function takes more time to execute (but still less than

AWS Lambda invoke function (js sdk): timeout resets to default

你。 提交于 2020-12-03 07:51:03
问题 I am running a Meteor (Node 4.4.7) application that performs long operations on AWS Lambda. I invoke the lambda function from my code and wait for the response before proceeding to the next invocation. I set the timeout to 300000ms as described in a former question (both on Lambda and in the AWS.Lambda object in my code). My problem is that sometimes the AWS.Lambda timeout value is reset to the default value of 120000ms. As my Lambda function takes more time to execute (but still less than

AWS Lambda invoke function (js sdk): timeout resets to default

强颜欢笑 提交于 2020-12-03 07:50:55
问题 I am running a Meteor (Node 4.4.7) application that performs long operations on AWS Lambda. I invoke the lambda function from my code and wait for the response before proceeding to the next invocation. I set the timeout to 300000ms as described in a former question (both on Lambda and in the AWS.Lambda object in my code). My problem is that sometimes the AWS.Lambda timeout value is reset to the default value of 120000ms. As my Lambda function takes more time to execute (but still less than

Attempting to decrypt ciphertext within a Lambda function using KMS results in timeout

孤人 提交于 2020-11-30 03:12:04
问题 When decrypting ciphertext from the command line using the AWS CLI, the ciphertext gets decrypted without issues: $ aws kms decrypt --ciphertext-blob fileb://encrypted-secrets --output text --query Plaintext --region us-east-1 | base64 --decode > decryped-secrets This decryption operation also works locally when attempting to do so from a js script: #!/usr/local/bin/node const fs = require('fs'); const AWS = require('aws-sdk'); const kms = new AWS.KMS({region:'us-east-1'}); const secretPath =

Attempting to decrypt ciphertext within a Lambda function using KMS results in timeout

|▌冷眼眸甩不掉的悲伤 提交于 2020-11-30 02:56:17
问题 When decrypting ciphertext from the command line using the AWS CLI, the ciphertext gets decrypted without issues: $ aws kms decrypt --ciphertext-blob fileb://encrypted-secrets --output text --query Plaintext --region us-east-1 | base64 --decode > decryped-secrets This decryption operation also works locally when attempting to do so from a js script: #!/usr/local/bin/node const fs = require('fs'); const AWS = require('aws-sdk'); const kms = new AWS.KMS({region:'us-east-1'}); const secretPath =