Questions tagged [aws-sdk-nodejs]

0

votes
1

answer
11

Views

AWS ALB returns 502 Bad Gateway when return audio buffer from Lambda in nodejs

I have a lambda function which does returns audio buffer in response, when I invoke lambda from code it works fine but when I Call lambda behind ALB ,I get error 502 Bad Gateway. // Lambda function handler 'use strict'; module.exports.handler = async (event, context) => { // ALB expects following re...
Dharam
1

votes
1

answer
86

Views

Upload Image into S3 bucket using Api Gateway, Lambda funnction

I'm trying to upload the image (base64) from the postman, I can see when I hit the Serverless API, something has been added in S3 bucket but not image, I'm using nodejs Lambda function, I tried so many solutions but that didn't work out. Please suggest me where I'm wrong: const AWS = require('aws-sd...
Nasreen Ustad
1

votes
3

answer
625

Views

Calling getItem() on DynamoDB object from AWS Lambda, why doesn't my callback execute?

I'm trying to get an item from my DynamoDB database. The way my code is presently written, I fail to retrieve any data from DynamoDB. I must be doing something wrong, because as far as I can tell from my test, my callback is not being called. I spent all day on this yesterday and have been tinkering...
Kevin Glick
1

votes
1

answer
277

Views

how to download all files with matching key from S3, using aws-sdk module in Node?

say in S3 bucket s3://my-bucket-name I had the following files: file1.txt file2.txt file3.txt abc.txt one.txt If I wanted to download files matching regex file*.txt, is it achievable through aws-sdk node module? If not what is something I can do?
ampersands
1

votes
0

answer
71

Views

What is the maximum outbound connections I can create from AWS Lambda?

I am looking at the documentation on Lamba Limits which says: Number of file descriptors 1,024 I am wondering if this is per invoking lambda or total across all lambdas? I am processing a very large number of items from a kinesis stream and I am calling a web endpoint and it I seem to be hitting...
justin.m.chase
1

votes
1

answer
141

Views

AWS SSM error : UnexpectedParameter: Unexpected key 'CloudWatchOutputConfig'

I am using AWS Lambda to Run Command in SSM. This is the code: const AWS = require('aws-sdk') const ssm = new AWS.SSM() exports.handler = (event, context, callback) => { ssm.sendCommand({ DocumentName: 'AWS-RunShellScript', CloudWatchOutputConfig : { CloudWatchOutputEnabled: true, CloudWatchLogGroup...
swapp1990
1

votes
0

answer
86

Views

Get return value of AWS getSignedUrl function within a seperate function with callback

I have a function to get a signedurl for s3 in a seperate javascript file(s3.js). Now I need to call that function in my route, placed in another file. getSignedUrl works and I was able to log the result correctly. But it doesn't pass result to the caller function. get signed url function (s3.js f...
Achira Shamal
1

votes
1

answer
170

Views

How to add or get a launch path to a product in AWS Service Catalog using Javascript sdk

I'm using Javascript SDK of AWS to access Service Catalog in my Lambda function. https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/ServiceCatalog.html#provisionProduct-property I have successfully created portfolio and product and attached the product to this portfolio. When I try to provision...
user2526961
1

votes
0

answer
233

Views

How to use AWS X-Ray in NodeJs?

I'm trying to use aws-xray-sdk to get the traces of my App, I have written three APIs, 1. Making a call to an AWS S3 service (/traceS3) 2. Making a HTTP call to external endpoint ie. google.com (/traceHttp) 3. Making a DB call to a locally installed MySql DB (/traceMysql) Also installed the AWS X-...
Aniruddha Raje
1

votes
0

answer
25

Views

Need help in knowing how to use aws-sdk-node in my current project

I have below questions specific to my project. - Can we use AWS-SDK with out node.js files / functions on AWS with minimal changes. - Right now the documentation is at very high level. I do not understand where the code changes have to be done. - Do I have to make changes in each and every function...
Nagendra Darla
1

votes
0

answer
227

Views

How to streaming data with POST request HTTP/2 AWS API in Nodejs?

I'm creating a NodeJs script to transcribe my recording file in real-time with Amazon Transcribe Service. They have AWS SDK for javascript (aws-sdk-js) Here But this js SDK hasn't yet implement start streaming transcription. However, they have a API called /start-transcription with HTTP/2 definition...
K. Tai
1

votes
1

answer
56

Views

Strange node.js + http + gm + s3 behavior

The purpose of this node.js code block is to download an image, resize it, upload the resized image to s3, and then upload the original image to s3. Non-Working code: http.get(url, function onResponse(res) { gm(res) .resize(250,250) .stream(function(err, stdout, stderr){ if(debug)console.log('Resize...
Jack
1

votes
1

answer
251

Views

AWS CloudSearch Upload JSON: Value tag cannot be array or object

I Am running a lambda function (NodeJS) to upload some documents to AWS Cloud Search. I keep getting the following error. { 'errorMessage': '{ [\'The value of tags cannot be a JSON array or object\'] }', 'errorType': 'DocumentServiceException', 'stackTrace': [ 'Object.extractError (/var/task/node_mo...
Abhishek Nandi
1

votes
1

answer
233

Views

Aws Cognito federated identities answers with UnknownError Not Found on getOpenIdTokenForDeveloperIdentity()

I have an issue in aws lambda (environment nodejs6.10), trying to register a user as custom provider. I'm calling getOpenIdTokenForDeveloperIdentity in my backend, with this params: const params = { IdentityPoolId: config.IDENTITY_POOL_ID, Logins: { [config.DEVELOPER_PROVIDER_NAME]: id } } The code...
napcoder
1

votes
1

answer
153

Views

Issue with invoking lambda from another lambda

I have 2 Lambda functions that I would like to call directly not through API Gateway. Lambda function A is Calling Lambda B along with queryStringParameters. For some reasons I'm getting this error { UnexpectedParameter: Unexpected key 'queryStringParameters' found in params This is my Lambda A fun...
Ash A
1

votes
3

answer
58

Views

Node js route not working,always shows cannot post

I have referred few answers on stackoverflow too,but still not working. When i use app.post function in app.js with a function it works but when i put route inside it it doesnt work and postman says cannot post. It was working fine 1 day ago. Here is the code of app.js let express=require('express')...
Cassius
1

votes
1

answer
166

Views

AWS Node JS MFA Cognito

I was working on aws sdk for node js, and trying to authenticate an user from a particular user pool. NOTE : my user pool has Multi-factor authentication enabled and receives OTP via SMS. This is my piece of code : ` var userData = { Username : 'username', Pool : userPool }; cognitoUser...
Shoubhik Hexa
1

votes
1

answer
194

Views

DynamoDb: UpdateExpression for updating arrays

Env: NodeJS service using aws-sdk for interacting with DynamoDb. Problem: When I set an attribute of an item to an array, it is saved as a string. I expect x: ['1'] but I get x: '1'. I believe this is because I'm incorrectly writing my UpdateExpression/ExpressionAttributeValues. Situation: I have a...
Naadof
1

votes
1

answer
81

Views

How many bits of integer data can be stored in a DynamoDB attribute of type Number?

DynamoDB's Number type supports 38 digits of decimal precision. This is not big enough to store a 128-bit integer which would require 39 digits. The max value is 340,282,366,920,938,463,463,374,607,431,768,211,455 for unsigned 128-bit ints or 170,141,183,460,469,231,731,687,303,715,884,105,727 for...
Justin Grant
1

votes
2

answer
35

Views

Piping a file straight to the client using Node.js and Amazon S3

So I want to pipe a file straight to the client; how I am currently doing it is create a file to disk, then sending that file straight to the client. router.get('/download/:name', async (req, res) => { const s3 = new aws.S3(); const dir = 'uploads/' + req.params.name + '.apkg' let file = fs.createWr...
perjermer
1

votes
1

answer
0

Views

NodeJS TLS/TCP server in need of an external firewall

Problem: I have an AWS EC2 instance running FreeBSD. In there, I'm running a NodeJS TLS/TCP server. I'd like to create a set of rules (in my NodeJS application) to be able to individually block IP addresses programmatically based on a few logical conditions. I'd like to run an external (not on the...
Nactus
1

votes
2

answer
2.1k

Views

How to Filter Nested Array Object in DynamoDB

I am very beginner to AWS DynamoDB, I want to scan the DynamoDB with SENDTO.emailAddress = '[email protected]' as FilterExpression. The DB Structure looks like this { ID NAME MESSAGE SENDTO[ { name emailAddress } ] } A Sample Data { ID: 1, NAME: 'HELLO', MESSAGE: 'HELLO WORLD!', SENDTO: [ { name: 'Fi...
Narayanan Ramanathan
1

votes
1

answer
963

Views

DynamoDB - scan and filter map with nodejs

I'm using nodejs to scan and filter a collection in dynamodb that looks like this: { 'name': 'teste123', 'id': '4bbe0f00-67c3-11e7-a6be-b9c9fc540ac2', 'clustermembers': [ { 'email': '[email protected]', 'role': 'ADMIN', 'id': '4bbe0f00-67c3-11e7-a6be-b9c9fc540ac2' } ] } With the following pice of cod...
Marrone
1

votes
1

answer
1.5k

Views

How do I allow access to the docker container on an EC2 instance

I have a build process that looks like this: 1. Code Pushed to BitBucket which is picked up by BitBucker Pipelines image: node:8.2.1 pipelines: default: - step: name: Push Server to AWS Repository script: - docker login -u AWS -p $AWS_ECR_LOGIN https://$AWS_ECR_URL - docker build -t dev . - docker t...
Bradley
1

votes
1

answer
37

Views

Use AWS CLI profile for specific node program's context

I have several AWS profile that I use for managing different projects. Let's call the default one 'user1', and the one I want to use 'user2' So if I just do a aws s3 ls it gives me user1's info of course, or if I do aws s3 ls --profile=user2 it gives me user2's, all good here I also know that I can...
Joshua Ohana
1

votes
1

answer
51

Views

How do I request a single record using AWS DynamoDB? Code samples are not working

I have taken the code sample down the the very basics and I am still unable to retrieve a single record by the key. Here is my basic example with nodejs (creds not included in this snippet): var dynamodbClient = new AWS.DynamoDB.DocumentClient(); var params = { TableName: 'newsarticles', Key: { id:...
contractorwolf
1

votes
1

answer
93

Views

PutItem with DynamoDB using lists / arrays

I'm trying to achieve something that I assumed would be pretty standard, but I've hit a wall with it. I have a bunch of data coming at me that I want to store in DynamoDB const putDataParams = { TableName: 'sensorNodeData2', Item: { 'deviceId': {'S': event.deviceId}, 'timeStamp': {'N': even...
monkey
1

votes
2

answer
109

Views

How to access parameter from aws parameter store using function in lambda

I'm trying to pull a parameter value from the Parameter Store using the following code: let ssm = new AWS.SecretsManager(); emailParam = { Path: '/myPath/Service/DestinationEmail'}; destinationEmail = ssm.getParametersByPath(emailParam, function(err, data){ if(err){ console.log(err, err.stack); } e...
rlcrews
1

votes
2

answer
706

Views

Using batchWriteItem in dynamodb

I have two tables in my dynamo db one is candidate table and the other one is user table I want to use batchWriteItem in dynamo db in order to add the data in the table. The query which I have formatted is as follows var user = { userid: usrid, role: 'candidate', password: vucrypt.encryptpass(pass)...
Arun VM
21

votes
3

answer
5.1k

Views

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

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...
zealoushacker
2

votes
1

answer
36

Views

How to include a custom header using AWS SDK with SQS Service?

I am using the AWS SDK SQS (with Nodejs) behind a router, to get through the router I need to include a custom header in the REQUEST. I've seen this documentation (https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Request.html#build-event) that talks about the .on ('build') event in REQUEST: v...
Neias
4

votes
1

answer
1.1k

Views

Stream and zip to S3 from AWS Lambda Node.JS

My goal is to create a large gzipped text file and put it into S3. The file contents consist of blocks which I read in loop from another source. Because of the size of this file I can not hold all data in memory, so I need to somehow stream it directly to S3 and ZIP at the same time. I understand ho...
Andremoniy
3

votes
1

answer
123

Views

DynamoDB DocumentClient returns Set of strings (SS) attribute as an object

I'm new to DynamoDB. When I read data from the table with AWS.DynamoDB.DocumentClient class, the query works but I get the result in the wrong format. Query: { TableName: 'users', ExpressionAttributeValues: { ':param': event.pathParameters.cityId, ':date': moment().tz('Europe/London').format() }, Fi...
boriskuete
3

votes
1

answer
596

Views

How to pass script to UserData field in EC2 creation on AWS Lambda?

I'm trying to pass a script in Userdata field of a new EC2 instance created by an AWS Lambda (using AWS SDK for Javascript, Node.js 6.10): ... var paramsEC2 = { ImageId: 'ami-28c90151', InstanceType: 't1.micro', KeyName: 'myawesomekwy', MinCount: 1, MaxCount: 1, SecurityGroups: [groupname],...
raffaeletalarico
1

votes
2

answer
1.1k

Views

Delete and create dynamoDB table

Using node.js i try to delete and create dynamoDB table again. I need to delete all records from table and put new, so i think is good solution to just delete and recreate whole table. I try with this code dynamo.deleteTable({ TableName: tableName }, function(err, data){ if (err) { console.log(err);...
Nemanja
2

votes
2

answer
1.5k

Views

How to Load config from ~/.aws/config

change log says Load config from ~/.aws/config if AWS_SDK_LOAD_CONFIG is set. Couldn't find any examples or documentation regarding how to load the config. Any help!
sreenivas
2

votes
2

answer
1.7k

Views

Mocking aws-sdk S3#putObject instance method using jest

For the source code containing: const S3 = require('aws-sdk/s3/clients') const s3 = new S3() s3.putObject(params, callback) I have added the following mock based on this article: jest.mock('aws-sdk/s3/clients') const S3 = require('aws-sdk/s3/clients') it('has to mock S3#putObject', () => { S3.proto...
vamsiampolu
2

votes
1

answer
280

Views

AWS S3 NodeJS Forbidden or Connection Rest

I have a NodeJS application on my local machine. I am trying to set it up with Amazon S3 services, but unfortunately, it doesn't work. I am able to get signed URL, but when uploading a file AWS returns Forbidden 403 (several times it dropped connection, but stopped after I removed timeout option fro...
shagrin
4

votes
2

answer
386

Views

How to read an individual column from Dynamo-Db without using Scan in Node-js?

I have 4.5 millions of records in my Dynamo Db. I want to read the the id of each record as a batchwise. i am expecting something like offset and limit like how we can read in Mongo Db. Is there any way suggestions without scan method in Node-JS. I have done enough research i can only find scan meth...
Vishnu Ranganathan
2

votes
1

answer
354

Views

s3 streaming with etags (node)

We are streaming content from S3 in node using createReadStream() in aws-sdk. We would like to add etag support. If we add the 'If-None-Match' header from the client, s3 throws NotModified as an error that I can't seem to handle. retrieveFile = function(req, res) { var s3 = new AWS.S3(); var pa...
Bryan Young

View additional questions