Questions tagged [aws-sdk-nodejs]

AWS SDK for JavaScript enables Node.JS developers to easily work with Amazon Web Services

The AWS SDK for JavaScript enables Node.JS developers to easily work with Amazon Web Services and build scalable solutions with Amazon S3, Amazon DynamoDB, Amazon Glacier, and more.

Getting Started

User Guide

API Documentation

519 questions
138
votes
14 answers

How to get response from S3 getObject in Node.js?

In a Node.js project I am attempting to get data back from S3. When I use getSignedURL, everything works: aws.getSignedUrl('getObject', params, function(err, url){ console.log(url); }); My params are: var params = { Bucket:…
Sara Fuerst
  • 5,688
  • 8
  • 43
  • 86
60
votes
8 answers

Call aws-cli from AWS Lambda

is there ANY way to execute aws-cli inside AWS Lambda? It doesn't seem to be pre-installed. (I've checked with "which aws" via Node.js child-process, and it didn't exist.)
50
votes
2 answers

How get Environment Variables from lambda (nodejs aws-sdk)

We can set up Environment Variables in aws-lambda for example via AWS SAM: Environment: Variables: TABLE_NAME: !Ref Table How can I get this variables from current lambda via Node JS AWS-SDK?
Max Vinogradov
  • 1,343
  • 1
  • 13
  • 31
44
votes
4 answers

using profile that assume role in aws-sdk (AWS JavaScript SDK)

Using the AWS SDK for JavaScript, I want to use a default profile that assumes the a role. This works perfectly with the AWS CLI. Using node.js with the SDK does not assume the role, but only uses credentials to the AWS account that the access key…
40
votes
4 answers

GET list of objects located under a specific S3 folder

I am trying to GET a list of objects located under a specific folder in an S3 bucket using a query-string which takes the foldername as the parameter and list all objects which match that specific folder using Node JS aws-sdk For example:…
appy
  • 559
  • 1
  • 8
  • 14
39
votes
4 answers

The "chunk" argument must be of type string or an instance of Buffer

I'm running the following code and it fails with the below error. AWS Code to list all objects inside a bucket. const http = require('http'); const host = '127.0.0.1'; const port = 5000; const path = require('path'); const url =…
anish anil
  • 2,299
  • 7
  • 21
  • 41
29
votes
5 answers

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 >…
27
votes
2 answers

How to upload a stream to S3 with AWS SDK v3

I have to transfer a file from and API endpoint to two different bucket. The original upload is made using: curl -X PUT -F "data=@sample" "http://localhost:3000/upload/1/1" The endpoint where the file is uploaded: const PassThrough =…
Hollyol
  • 827
  • 1
  • 13
  • 25
22
votes
3 answers

AWS S3 - The request signature we calculated does not match the signature you provided. Check your key and signing method

I am trying to upload images to s3 with a pre signed url generated from the aws sdk. router.get('/upload-url', async(req, res) => { try { AWS.config.update({ secretAccessKey: process.env.AWS_SECRET_ACCESS, …
21
votes
2 answers

How to Get Signed S3 Url in AWS-SDK JS Version 3?

I am following the proposed solution by Trivikr for adding support for s3.getSignedUrl api which is not currently available in newer v3. I am trying to make a signed url for getting an object from bucket. Just for convenience, the code is being…
Waleed93
  • 1,130
  • 2
  • 15
  • 24
20
votes
5 answers

How to mock S3 with jest?

I am tryng to code a test for upload. But i am not understating how to properly use jest.mock('aws-sdk') export class S3Service { private readonly s3: S3; private readonly bucket: string; constructor(private readonly configService:…
luickx
  • 209
  • 1
  • 2
  • 5
17
votes
5 answers

How AWS Credentials works at GitHub Actions?

At my unit tests, I'm using aws-sdk to test the SES, which needs some credentials, we are facing a problem to access the secrets with GitHub Actions. At beginning I was trying to set the values to ~/.aws/credentials using the run command from github…
fsilva
  • 406
  • 1
  • 3
  • 9
17
votes
3 answers

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,067
  • 1
  • 19
  • 29
16
votes
4 answers

How to save file from S3 using aws-sdk v3

With the new aws-sdk v3, specifically @aws-sdk/client-s3, it's not clear to me how to store files to disk from S3. Having the following code const { Body } = await s3.send(new GetObjectCommand({ Bucket: 'myBucket', Key: 'myKey', })) The Body…
mike
  • 5,047
  • 2
  • 26
  • 32
16
votes
3 answers

AWS NodeJS SDK V3 DynamoDB UpdateItem - TypeError: Cannot read property '0' of undefined

I am trying to get a basic database update operation to work in nodejs using the new AWS SDK V3 for NodeJS. The data object that I am trying to update looks like this: { auth: { BOOL: false }, username: { S: 'siegbert' }, secondsLeft: { N:…
1
2 3
34 35