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.
725
questions
0
votes
1
answer
19
views
How to filter in AWS Congito with multiple filter conditions in ListUsersCommand in Node.js?
We want to filter out the user list with multiple filter conditions, like on email and status in the node.js. Tried below filter condition but it did't work.
Code snippet of node.js
const client = new ...
0
votes
1
answer
27
views
Hitting Presigned URL to download object and get access denied exception
In our code base, we are aiming to render the S3 GetObject SignedURL for the client, so the client can download the object by clicking the url in the website .
Here is the v2 code:
return s3Client....
0
votes
1
answer
36
views
What is the difference between "amazon-dax-client" and "@aws-sdk/client-dax"?
Can either of them be used to configure dax client and perform operations on it?
I wasn't able to use "@aws-sdk/client-dax" to configure client and perform getItem command.
const { DAXClient,...
0
votes
1
answer
21
views
Update Inconsistent on DynamoDB
I've implemented a lambda function. During testing, updating of the item's attribute seems inconsistent. Most of the time it won't update and seldom it will update.
Here's a snippet of my code.
const ...
1
vote
2
answers
41
views
lib-dynamodb does not show nested lists
I have a DynamoDB table that has an Item that is as follows:
{
"Item": {
"myPrimaryKey": {
"S": "config"
},
"...
0
votes
0
answers
18
views
MQTT try retrying connection for WebSocket protocol even after if logout from my application
Here is my code snippet
getClient(iotInput: IIotInput) {
const accessKeyId = iotInput.accessKeyId;
const secretKey = iotInput.secretAccessKey;
const host = iotInput.endpoint;
...
0
votes
0
answers
22
views
AWS Amplify apps with AWS services
I'm having my Next.js app deployed on AWS Amplify, and within my app I need to publish a message to an SQS queue. Locally I can work with the aws-sdk using environment variables ( AWS_ACCESS_KEY_ID ...
2
votes
1
answer
97
views
AWS SDK v3 - How to get TypeScript to compile the construction of DynamoDB client with custom timeout?
It seems that in AWS SDK v3, in order to construct a DynamoDB client with custom timeout you need to first create a NodeHttpHandler and pass it as a requestHandler in the constructor of the DynamoDB ...
0
votes
1
answer
56
views
How can I send a succesfull TransactWriteItemCommand in AWS-SDK v3 for nodejs?
I'm sending a TransactWriteItemCommand to DynamoDB using AWS-SDK v3 in nodejs.
I'm using just one PUT command.
I'm getting a TypeError (see below).
I can`t find the bug, everything looks good to me.
...
2
votes
2
answers
208
views
Why do I get 401 Unauthorized when I use the AWS SDK with Cloudflare R2 Storage?
I'm trying to list objects in a Cloudflare R2 storage bucket using the AWS SDK for JavaScript (v3) in a Node.js application, but I'm encountering an 'Unauthorized' error.
Here is the code snippet that ...
0
votes
0
answers
41
views
Should a new S3 client be initiated on every request?
I am creating a simple CRUD api using NodeJS + TS and AWS SDK.
I configured AWSCognito and IAM services for accessing S3 resources.
User can for example request a service that returns all the objects ...
2
votes
0
answers
32
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
1
answer
49
views
Why does my S3 presigned URL not work after changing the client's time?
I am working on a project, where I need to fetch the presigned URL for a PDF in a private S3 bucket via React Native.
I'm using aws-sdk(v2.1381.0).
I've set the expiry parameter as 24 hours. The URL ...
1
vote
2
answers
93
views
Why does API Gateway return Internal Server Error when using a custom Lambda Authorizer?
I have a listUsers function which was working perfectly with cognito authorizer.
Since I've changed it to a Lambda Authorizer, it returns a 500 HTTP status code.
serverless.yml:
provider:
httpApi:
...
0
votes
2
answers
71
views
How can I put a new value into PutCommand Item if variable is not "undefined" in DynamoDB
As the title said, I want to put a variable into one of its Item only if the variable is not undefine.
I've tried this code.
const createNewAccount = new PutCommand({
TableName: tableName,
...
0
votes
0
answers
16
views
NodeJS AWS SDK - see live logs (like --follow from AWS CLI)
In AWS CLI there is an option to run
aws logs tail some-group --follow
To see live logs from some group.
I would like to achieve the same, ideally getting a Readable I could subscribe to using NodeJS ...
0
votes
0
answers
31
views
Can't find appropriate way to track progress using uploadId in new AWS SDK v3
Here is the code snippet that I use with old AWS SDK v2 in NodeJS.
const partInformation = await this.s3
.uploadPart({
Bucket: "BucketName",
Key: "...
1
vote
0
answers
33
views
How to use getLoggerPlugin() in @aws-sdk/middleware-logger?
I see this function is used at many places in the v3 clients, For example here is there any proper usage documents?
0
votes
0
answers
19
views
AWS - ec2Client.send never resolves in AWS SDK V3 JS
I'm setting up a lambda for monitoring purposes using AWS SDK for JS V3. I want to retrieve the health status of an instance, this is the code
import { EC2Client, DescribeInstanceStatusCommand } from &...
0
votes
0
answers
46
views
How to resolve CORS configuration ovh cloud?
I want to upload a file to my bucket object storage on ovh cloud using s3.upload from aws-sdk in react, and I have already configured CORS of the server like this:
{
"CORSRules": [
...
0
votes
0
answers
50
views
AWS v2 s3.getPresignedUrl vs AWS V3 getSignedUrl
I seem to not be able to get my files to upload with the new Presigned url in AWS V3 SDK.
The following is my AWS-SDK v2 code
await s3Client.getSignedUrlPromise('putObject', {
Bucket: process....
1
vote
1
answer
26
views
Presigned URL with IAM user from console works. From code it does not?
I am trying to generate a presigned url from my s3 bucket using an IAM user. The user permissions I have setup for the IAM user work if I log into the aws console as the IAM user and create the ...
1
vote
1
answer
49
views
Why does Cognito not return NewDeviceMetadata for CUSTOM_AUTH flow so that I can remember devices?
When using the CUSTOM_AUTH flow in Amplify SDK for React, even on a new device after PASSWORD_VERIFIER no NewDeviceMetadata is sent back thus preventing from marking the logged in device as ...
1
vote
1
answer
363
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 ...
0
votes
1
answer
111
views
Validate Cognito SMS_MFA code using aws sdk in Nodejs
I have react login page. When user enters username/password, request goes to backend and backend executes signInUser method as shown below.
NOTE:
If MFA is disabled for a user, it returns a set of ...
0
votes
0
answers
61
views
Using the AWS AppConfigDataClient to fetch configuration data from the extension's localhost
I am using the AWS AppConfigDataClient (https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/appconfigdata/) to fetch configuration data.
There is also an AppConfig layer I have added to my ...
1
vote
1
answer
62
views
how to configure a service client object in the JavaScript SDK v3?
From example here i want to know how we can achieve in aws sdk JS v3?
The following example configures a service client object in javascript sdk object in v2. I want to know how we can achieve ...
0
votes
0
answers
88
views
JS AWS Websocket API Gateway client sdk v3 will not post to client with endpoints I provide. Documents are unclear what to do with Custom Domains
I am setting up a WebSocket API in Api Gateway. I am currently using v1 of the SDK, and I want to move to V3. This is the code that I have attempted to use:
const apiGwManApiClient = new ...
1
vote
1
answer
222
views
How to send data to Kinesis Data Firehose using the AWS JavaScript SDK v3?
I am trying to send JSON data to Kinesis Data Firehose, where it will be delivered to an S3 bucket.
It works with AWS SDK v2:
const AWS = require('aws-sdk');
// Full config not shown.
AWS.config....
4
votes
1
answer
170
views
Design pattern for wrapping aws-sdk Javascript v3
Our team is moving from aws-sdk v2 to v3. We have a common package that has a wrapper around aws-sdk which takes care of common logging to aws sdk service calls and update few configs ( This wrapper ...
0
votes
1
answer
170
views
@aws-sdk/lib-storage/Upload sends inclomplete request body for CompleteMultipartUpload
I am using the Upload class from @aws-sdk/lib-storage to upload files to an S3 bucket, directly from the browser.
export const putObject = (s3Client, bucketName, path, file) => {
const params = {
...
0
votes
2
answers
342
views
@aws-sdk/client-s3 new SDK version v3 - Region is missing error
I am migrating S3 client on node.js from v2 to v3. And getting error: Region is missing, when using any command: s3Client.send(\\any command\\);
I have the latest libraries v3.405.0 and initialise S3 ...
0
votes
1
answer
59
views
Getting ValidationException on UpdateTableCommand (AWS SDK)
I'm trying to the update the deletion protection setting for my DynamoDB table:
this.#docClient = new DynamoDBClient({ region: REGION });
...
updateParams = {
TableName: TABLE_NAME,
...
-1
votes
1
answer
113
views
Serverless Offline: Route Not Found" Error Despite Correct Configuration
Hello Stack Overflow community,
I'm facing an issue with the Serverless Framework and the serverless-offline plugin where I'm getting a "route not found" error despite having the correct ...
0
votes
1
answer
122
views
AWS XRay with AWS SDK v3 for NodeJS: typing issues
I'm moving my xray tracing for my aws-sdk from v2 to v3 and having some issues using the code provided from aws here: https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-nodejs-awssdkclients....
0
votes
0
answers
19
views
'MalformedPolicyDocument Error on CreatePolicyCommand for AWS SDK V3
I am trying to pass an array of buckets of another AWS account A to a policy of account B.I am getting error:
Error: {
Type: 'Sender',
Code: 'MalformedPolicyDocument',
Message: 'The policy failed ...
2
votes
1
answer
308
views
TypeError: Cannot read property 'decode' of undefined in React Native with AWS S3 SDK
It's been a joruney trying to get simple file uploads to an AWS S3 bucket working from my react native app built with expo.
Current problem: Upon attempting the upload, I get an error saying:
Failed ...
0
votes
1
answer
52
views
How to use OR operator with DynamoDB KeyConditionExpression
DynamoDB table has three data rows all with the same PK value but different SK:
Row 1: PK: PROJECT SK: A-001
Row 2: PK: PROJECT SK: B-001
Row 3: PK: PROJECT SK: C-001
I want to make query that returns ...
0
votes
1
answer
280
views
streaming response from Lambda with InvokeWithResponseStreamCommand
I have the following code in a react-native app that calls a Lambda in my AWS tenant. The Lambda fires just fine, all the console.logs come out correct (200, correct content-type, etc.), and I can ...
0
votes
1
answer
94
views
ARN User for AWS S3 Bucket how to manage Bucket via API NodeJS
My problem is that I want to upload some data to the AWS S3 Bucket via API - NodeJS @aws-sdk packge, but I don't have credentials to the account where the Bucket is.
Credentials needed to connect in ...
0
votes
0
answers
35
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, ...
0
votes
2
answers
397
views
Read and write from S3 within SvelteKit using AWS SDK v3
I'm trying to use @aws-sdk/client-s3 to read and write some files to an S3 bucket. However, when trying to do this within SvelteKit I get this error:
CredentialsProviderError: Could not load ...
0
votes
0
answers
113
views
Lambda authorizer (node 18.x runtime) ending before execution of aws-sdk command
I have a Lambda authorizer (used by API Gateway) running on a NodeJS 18.x runtime
In this Lambda, I need to use some Command from @aws-sdk. My code is running correctly until the Command. The Lambda ...
0
votes
1
answer
115
views
Does AWS SDK JS v3 no longer support hardcoding credentials in React Native Apps?
I am creating a React Native app that involves sending some kind of information to AWS using AWS Simple Notification Service (SNS). This is a one-way operation that the device publishes some string to ...
0
votes
2
answers
58
views
Able to list Bucket but cannot upload a file
Using ASW javascript SDK v2 (cannot use v3 for dependency reasons related to my project)
I am facing an error when trying to upload a file to an S3 bucket with the following JS code.
FYI :
I am able ...
1
vote
1
answer
229
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
0
answers
70
views
aws-sdk V3 & CognitoIdentityServiceProvider
I'm using a Lambda Function based on nodejs18.x runtime.
This function should list AppClient From a Cognito UserPool so it should use CognitoIdentityServiceProvider class and listUserPoolClients ...
0
votes
0
answers
46
views
Getting Error : Can't walk dependency graph when importing @aws-sdk/client-s3
Inside a Cypress test I am adding a new function to upload a file in S3.
I am making my function very simple for the moment :
Cypress.Commands.add('uploadToS3', () => {
(async function() {
//...
1
vote
0
answers
43
views
UnknownError when testing CloudFront Function via AWS SDK for Javascript
I have a CloudFront Function and I'm trying to test it using AWS SDK for Javascript. This is my code:
const client = new CloudFrontClient(); // configured using env variables
const eventObject = ...
0
votes
1
answer
83
views
Does AWS SDK or CLI provide offset support on pagination when listing S3 bucket?
Does AWS offer any kind of offset when paginating objects inside S3 bucket, either using SDK or CLI? As I am implementing regular navigation in my client, I need to have support for offset pagination ...