Questions tagged [aws-sdk-js]

The official AWS SDK for JavaScript provides an API to many AWS services, including: S3, SNS, SQS, EC2, Route53, etc... This library can be used in front-end Javascript which is executed in the browser as well as in NodeJS.

aws-sdk-js
Filter by
Sorted by
Tagged with
7 votes
2 answers
5k views

specifying the signature version of s3 client in aws sdk version 3

In aws-sdk v2 for javascript, we instantiate s3 client using: var s3 = new AWS.S3({ accessKeyId: 'YOUR-ACCESSKEYID' , secretAccessKey: 'YOUR-SECRETACCESSKEY' , ...
0 votes
0 answers
25 views

How do I test the values used to instantiate an aws client?

I am updating a class typescript module to start using v3 of the aws-sdk. In one of the methods I have the lines: const eventBridgeClient = new EventBridgeClient({ region: this.region }) const ...
2 votes
1 answer
107 views

how to access properties of promise that resolves two types

In my typescript/node code, I am following an example at https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/modules/_aws_sdk_lib_storage.html, where I have a line as follows: const { VersionId } = ...
6 votes
2 answers
2k views

What is the difference between @aws-sdk/client-ses and @aws-sdk/client-sesv2?

AWS's SDK for JavaScript version 3 seems to have 2 different clients for Simple Email Service (SES). I realized I have been using @aws-sdk/client-sesv2 but: The actual doc on their GitHub repos is ...
1 vote
1 answer
32 views

DynamoDB: Using SET on an UpdateExpression to increment a field is not working

I'm following the AWS docs in order to implement a lambda to increase the value of a field with an scalar value in DynamoDB. In my case I'm using NodeJS SDK v3, but the docs redirect you to this page ...
8 votes
2 answers
3k views

Cloudformation deploy aws sdk for javascript

Looking at the AWS sdk for Javascript, it appears we can only create stacks but i'm looking of a way to deploy a stack. How would I do that with the provided sdk; this is what they currently have: ...
2 votes
3 answers
1k views

Getting credentials for logged in user via Amplify Auth

I am using AWS Amplify for a ReactJS application. The only two functional areas I am using from Amplify are Authentication and Hosting. These two are working fine, and a Cognito user pool associated ...
0 votes
1 answer
80 views

AWS JavaScript SDK v3 : SignatureDoesNotMatch : The request signature we calculated does not match the signature you provided

I'm trying to setup a node.js app that will upload files to an S3 bucket. I keep getting this error: SignatureDoesNotMatch : The request signature we calculated does not match the signature you ...
0 votes
0 answers
26 views

Creating cloudfront url for s3 static site from nodejs AWS-SDK

Creating cloudfront url for s3 static site from nodejs AWS-SDK Here is the reference https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CloudFront.html#createDistribution-property It is long form ...
0 votes
1 answer
63 views

Is this a safe way to use aws-sdk on client side?

I have read different opinions so I'd like expert ones. My question is basic: If I create a react app (only client side), from where I'm planning to read a s3 object, is the following a safe approach ...
0 votes
0 answers
10 views

aws-sdk v2 to v3 migration question - IniLoader [duplicate]

I am doing an 'aws-sdk' v2 > v3 migration and I'm trying to find the v3 equivalent of the following v2 code: const profiles = Object.keys((new AWS.IniLoader()).loadFrom({}); The closest thing I ...
0 votes
0 answers
13 views

DynamoDB documentClient.transactWrite throws ValidationException, but the datatype is correct

I rewrote some code to take advantage of the transaction API. When I try to update an object containing product information I get the following error: ValidationException: ExpressionAttributeValues ...
0 votes
0 answers
22 views

How to get a credential-provider that runs from another AWS IAM User

The AWS account I work in has 2 main IAM users: User A has most of the important execution permissions (Lambda, SecretsManager, API GateWay...) User B has only 1 permission: AssumeRole to targetRole, ...
0 votes
0 answers
29 views

aws js sdk -- unable to get local issuer certificate in local node script, but works just fine with aws cli

I am writing a helper to enable running a lambda function locally. There are DynamoDB and other calls to AWS services in this function. When I run my script, the aws-sdk says it cannot get the local ...
0 votes
0 answers
138 views

Error: No value provided for input HTTP label: Bucket while putting a file in S3 with aws-sdv V3

I am getting error Error: No value provided for input HTTP label: Bucket while putting an object ( a file ) in S3 using AWS-SDK V3 apis in a nodejs service. Here is code I am using : const ...
2 votes
2 answers
322 views

S3Client throws Readable.toWeb() is not supported error when using transformToWebStream

I am using NodeJS 14 version. I have the following code to download a file from AWS S3 using aws-sdk version 3. static async downloadFromS3(document: Document) { let s3 = new S3Client(...
1 vote
1 answer
85 views

Updating aws-sdk v2 to v3 breaks DynamoDB call in Synthetics Canary

Interesting issue after updating to v3. The updated code works fine in tests, locally and in lambdas, but fails when running it within a Synthetics Canary. Might be an easy solution, but haven't found ...
0 votes
1 answer
198 views

Getting [TypeError: Cannot read property 'apply' of undefined] - is the AWS V3 SDK compatible with React Native?

Background: I am investigating possible tech stacks for a project, so I am trying a bunch of things I'm not very familiar with. ( rough going, obviously ) I see Amazon recommends Amplify for React ...
12 votes
4 answers
28k views

DynamoDB get item TypeScript hell

Can anyone explain how to use GetItemInput type when calling DocumentClient.get ? If I pass in an object of any type get works but if I try and strongly type the params object I get this error: ...
0 votes
0 answers
31 views

Getting [Error: Credential is missing] using @aws-sdk/client-verifiedpermissions with AWS Cognito for getting Permissions

I am using the IsAuthorizedWithTokenCommand Command from @aws-sdk/client-verifiedpermissions to get authorization using the identity token generated by cognito, but i am getting the error: ...
0 votes
0 answers
15 views

[Error: crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported]

I'm running into issues when calling the BedrockClientRuntime in my expo emulator. Currently, this is how I am calling the client: const client = new BedrockRuntimeClient({ region: "<...
3 votes
1 answer
2k views

AWS -SES: Adding link in my email template

I have to send an email using template through AWS SES. { "Template": { "TemplateName": "resetPasswordEmailTemplate", "SubjectPart": "FBO Hangars- Recover Password", "HtmlPart": "Hi {{name}},\r\n ...
2 votes
1 answer
1k views

How to find the aws-sdk version in v3 javascript

I'm aware we can find the current aws-sdk(v2) version in lambda runtime from AWS.VERSION environment variable. In v3, aws-sdk is modularized, is there a way to find the which version of the aws-sdk ...
0 votes
0 answers
31 views

Image uploaded to AWS S3 through Node aws-sdk is corrupted

I am uploading an image to aws-s3 with the aws-sdk. The image seems to be sucessfully written to my bucket but, when I download the image through the aws dashboard or using GetObjectCommand, the image ...
0 votes
2 answers
118 views

AWS tries to read config from file system

I'm trying to send an email using AWS SES from a Supabase cloud function. I've set up the AWS env variables, but it still tries to read the config from filesystem, which fails 'cause there's no ...
0 votes
0 answers
9 views

Why is file AWS_restXML.js included in minified bundle?

I am creating a bundle of a AWS Lambda function that uses @aws-sdk/client-s3. The largest file in the bundle according to https://esbuild.github.io/analyze/ is AWS_restXML.js coming in at 143 kb. ...
7 votes
2 answers
12k views

ListObjectsV2 - Get only folders in an S3 bucket

I am using AWS S3 JS SDK. I have folders within folders in my S3 bucket and I would like to list only folders at a certain level. This is the structure: bucket/folder1/folder2/folder3a/file1 bucket/...
1 vote
0 answers
86 views

aws sdk v3 lib-storage: upload file of 112 GB crash chrome for out of memory

I have bundled "@aws-sdk/lib-storage" and "@aws-sdk/client-s3" with webpack for use it on frontend package.json { "name": "aws-s3-upload", "version&...
4 votes
2 answers
4k views

AWS-SDK-S3-Client throws "Error: Resolved credential object is not valid" while executing putObject command

When I am trying to upload a file using aws-sdk-s3-client in nodejs. It throwing an validation error: Error: Resolved credential object is not valid at SignatureV4.validateResolvedCredentials (/api/...
1 vote
1 answer
691 views

How to test GetParameter of SSM using aws-sdk-client-mock in typescript

I want to write test case for SSM GetParameterCommand request in typescript. My code looks like: const region = "us-east-1" const awsSSMClient = new SSMClient({ region }) export async ...
14 votes
4 answers
22k views

How do I mock AWS S3 GetObjectCommand with jest using the v3 sdk?

Testing an s3 upload? The method to test is export class ProcessData { constructor() {} async process(): Promise<void> { const data = await s3Client.send(new GetObjectCommand(bucket)); ...
1 vote
0 answers
76 views

Multer S3 (v3) type error when implementing AWS SDK (v3) - missing properties from type 'S3'

I'm in the process of upgrading my AWS SDK from v2 to v3 (@aws-sdk/client-s3 v3.496.0). This includes upgrading multer-s3 to v3.0.1 to be compatible as stated by their docs. But I'm getting the ...
0 votes
0 answers
56 views

Can't fetch ListUsers with CognitoIdentityProviderClient (aws-sdk) and next.js (v14 with /app router)

I have problems fetching users list from Cognito User Pool using aws/sdk. I'm working with next.js with /app router (v14.0.4), aws-amplify (v6.0.10) and @aws-sdk/client-cognito-identity-provider (3....
184 votes
9 answers
146k views

Nodejs AWS SDK S3 Generate Presigned URL

I am using the NodeJS AWS SDK to generate a presigned S3 URL. The docs give an example of generating a presigned URL. Here is my exact code (with sensitive info omitted): const AWS = require('aws-...
0 votes
0 answers
46 views

When AWS STS credentials expire during upload

I received the sts credential from the server and using it to create an s3 object and upload it. // aws sdk v2 // STS credentials //{aws_access_key_id, aws_secret_access_key, aws_session_token, ...
0 votes
0 answers
39 views

React Native AWS SDK

I want to store my aws s3 access key id and secret key in my react native app. I am using it to upload files to my s3 bucket using presigned url. What is the best way to store this creds. I stored it ...
0 votes
2 answers
146 views

AWS S3 Access and Secret Key management in React Native

I want to store my aws s3 access key and secret key in my react native app. I am storing it in env file and using it via react-native-config. But i received a mail from play console saying the key is ...
0 votes
1 answer
94 views

waitUntilInstanceRunning in the AWS JS SDK hangs

I'm writing a small function to start and stop some of our AWS resources outside of office hours, based on this article. Currently my code looks like this - edited for brevity. import { EC2Client, ...
3 votes
3 answers
1k views

Decrypting cognito codes with KMS client from aws-sdk-v3

I am following this instruction to implement custom message sender in Cognito https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-custom-sms-sender.html All works well with ...
0 votes
1 answer
34 views

Cannot see the properties of CognitoUserPool Class from amazon-cognito-identity-js Nuxt3

I am using the amazon-cognito-identity-js library to create a new user in Amazon Cognito, but I cannot view the properties of the class CognitoUserPool. My application is Nuxt3 using Pinia. Steps that ...
0 votes
0 answers
25 views

Pricing api for the Aws Savings plan?

I'm currently working on developing an AWS cost calculator. I've managed to retrieve the reserved and on-demand prices using the query API successfully. However, I've encountered an issue as the API ...
3 votes
2 answers
1k views

Why does the InvokeModelCommand for AWS Bedrock Cohere model return numbers and not text?

I have a file called bedrock.mjs in AWS Lambda with the below code: import { BedrockRuntimeClient, InvokeModelCommand, } from "@aws-sdk/client-bedrock-runtime" export const ...
1 vote
0 answers
117 views

'The provided ARN is invalid' error when locally running a Step Function that calls EventBridge Scheduler

I am running a Step Function using the AWS JS SDK v3 that gets and creates schedules with AWS EventBridge Scheduler. When I run it in the AWS account, I am able to run the step function. However, when ...
2 votes
2 answers
342 views

Invoke AWS Lambda into React page using aws-sdk

I have this simple form executed into React page: import React from 'react'; import { Link } from 'react-router-dom'; import {LambdaClient, InvokeCommand, LogType} from "@aws-sdk/client-lambda&...
1 vote
1 answer
150 views

AWS S3 Javascript SDK v2 allows for full path but v3 does not. How can I access the files in S3 with a full path?

My application used to use AWS JavaScript SDK v2. In this version I could have a bucket name with slashes. The pattern of this bucket name is: <bucket_name>//. Essentially mocking a folder ...
0 votes
0 answers
123 views

What are the implications of AWS SDK for JavaScript (v2) being put into maintenance mode in 2023?

We are using Lambda service to run our JavaScript codebase. We have noticed the following message: ERROR (node:8) NOTE: The AWS SDK for JavaScript (v2) will be put into maintenance mode in 2023 Is ...
0 votes
1 answer
99 views

Delete multiple files from digitalocean spaces using aws-sdk/client-s3

I want to delete multiple files from digitaloceans spaces but keep getting errors. Environmental variables are all set My current code: const { S3Client, DeleteObjectsCommand } = require("@aws-...
2 votes
1 answer
130 views

Why can't I register one specific version of `@aws-sdk/client-ssm` to my tsyringe container but another version works?

I want to register the @aws-sdk/client-ssm with my my tsyring container like all the other aws services I am using. However when I am using "@aws-sdk/client-ssm": "3.435.0" and ...
0 votes
0 answers
76 views

How to create temporary AWS credentials for lambda

This is in response to the post in How to pass aws credentials I am trying to get temporary credentials that aws batch can assume by running a lambda script. When I tested the lambda locally from AWS ...
0 votes
0 answers
33 views

How to fetch aws cognito user pool attribute.email data into website console log ,after successfully logined with microsoft AD

My Workflow is that I redirected my website to AWS Cognito with Microsoft AD for sign-in. So when any user was logging into Microsoft and after successfully login redirected to my website. this is ...

1
2 3 4 5
15