Giter Site home page Giter Site logo

awsdocs / aws-sdk-for-javascript-v3 Goto Github PK

View Code? Open in Web Editor NEW
111.0 29.0 86.0 1017 KB

The open source version of the AWS SDK for JavaScript V3 developer guide. You can submit feedback & requests for changes by submitting issues in this repo or by making proposed changes & submitting a pull request.

License: Other

aws-sdk-for-javascript-v3's Introduction

aws-sdk-for-javascript-v3's People

Contributors

allanzhengyp avatar alteredorange avatar anees-tricon avatar brmur avatar bunnyapocalypse avatar ddeepeshkumar avatar deepskd avatar dominicgbauer avatar doug-aws avatar dscalzi avatar floydpink avatar ikhemissi avatar inuwyze avatar jagrutsharma avatar jamesiri avatar jansepke avatar joshbean avatar karlbecker avatar kimson99 avatar larrytech7 avatar lipilee avatar michalwierzba avatar muhammedmoussa avatar nberlette avatar olliechick avatar paul-b-aws avatar singledigit avatar trivikr avatar ypliu-aws avatar zendagin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aws-sdk-for-javascript-v3's Issues

Send Email AWS SDK for JavaScript is not working

`_const AWS = require('aws-sdk');
AWS.config.update({region:'ap-south-1'});
var ses = new AWS.SES();

var sesParams = {
Destination: {
ToAddresses: [
"@gmail.com"
]
},
Message: {
Body: {
Html: {
Charset: "UTF-8",
Data: "This message body contains HTML formatting."
},
Text: {
Charset: "UTF-8",
Data: "some data"
}
},
Subject: {
Charset: "UTF-8",
Data: "Order Status"
}
},
ReplyToAddresses: [
],
ReturnPath: "",
ReturnPathArn: "",
Source: "
****@gmail.com",
SourceArn: "",
};
var sendPromise = ses.sendEmail(sesParams).promise();

// Handle promise's fulfilled/rejected states
sendPromise.then(
function(data) {
console.log(data.MessageId);
}).catch(
function(err) {
console.error(err, err.stack);
});_`

Followed all the instruction as per the documentation
https://docs.amazonaws.cn/en_us/sdk-for-javascript/v2/developer-guide/ses-examples-sending-email.html#ses-examples-sendma

Error:

PS F:\Projects\AWS SDK Projects> node .\sendMail.js
InvalidParameterValue: Invalid email address .
at Request.extractError (F:\Projects\AWS SDK Projects\node_modules\aws-sdk\lib\protocol\query.js:50:29)
at Request.callListeners (F:\Projects\AWS SDK Projects\node_modules\aws-sdk\lib\sequential_executor.js:106:20)
at Request.emit (F:\Projects\AWS SDK Projects\node_modules\aws-sdk\lib\sequential_executor.js:78:10)
at Request.emit (F:\Projects\AWS SDK Projects\node_modules\aws-sdk\lib\request.js:688:14)
at Request.transition (F:\Projects\AWS SDK Projects\node_modules\aws-sdk\lib\request.js:22:10)
at AcceptorStateMachine.runTo (F:\Projects\AWS SDK Projects\node_modules\aws-sdk\lib\state_machine.js:14:12)
at F:\Projects\AWS SDK Projects\node_modules\aws-sdk\lib\state_machine.js:26:10
at Request. (F:\Projects\AWS SDK Projects\node_modules\aws-sdk\lib\request.js:38:9)
at Request. (F:\Projects\AWS SDK Projects\node_modules\aws-sdk\lib\request.js:690:12)
at Request.callListeners (F:\Projects\AWS SDK Projects\node_modules\aws-sdk\lib\sequential_executor.js:116:18) {
code: 'InvalidParameterValue',
time: 2021-03-22T21:12:55.853Z,
requestId: '97744c92-8e0f-4c54-bfdc-32c0d9d9210c',
statusCode: 400,
retryable: false,
retryDelay: 76.12391045843472
} InvalidParameterValue: Invalid email address .
at Request.callListeners (F:\Projects\AWS SDK Projects\node_modules\aws-sdk\lib\sequential_executor.js:106:20)
at Request.emit (F:\Projects\AWS SDK Projects\node_modules\aws-sdk\lib\sequential_executor.js:78:10)
at Request.emit (F:\Projects\AWS SDK Projects\node_modules\aws-sdk\lib\request.js:688:14)
at Request.transition (F:\Projects\AWS SDK Projects\node_modules\aws-sdk\lib\request.js:22:10)
at AcceptorStateMachine.runTo (F:\Projects\AWS SDK Projects\node_modules\aws-sdk\lib\state_machine.js:14:12)
at F:\Projects\AWS SDK Projects\node_modules\aws-sdk\lib\state_machine.js:26:10
at Request. (F:\Projects\AWS SDK Projects\node_modules\aws-sdk\lib\request.js:38:9)
at Request. (F:\Projects\AWS SDK Projects\node_modules\aws-sdk\lib\request.js:690:12)
at Request.callListeners (F:\Projects\AWS SDK Projects\node_modules\aws-sdk\lib\sequential_executor.js:116:18)

update DynamoDB examples

The V3 DynamoDB guide is outdated. We recommend users to use @aws-sdk/lib-dynamodb instead of @aws-sdk/client-dynamodb package. Please update per README.

[Suggestion] Change ProxyAgent example.

In my experience, ProxyAgent does not work out of the box. Several things are missing/broken, like the ability to pass options to tls.connect. When first setting it up, I had to spend a day searching through the source code/issue tracker just to patch in a workaround for setting the ca value. Setting the certificate really should not be that hard. Not only that, but there are issues and PRs mentioning/fixing these problems which have not been responded to over a year later.

My suggestion is to replace the example currently on the doc (https://github.com/awsdocs/aws-sdk-for-javascript-v3/blob/main/doc_source/node-configuring-proxies.md) with hpagent (https://github.com/delvedor/hpagent). Everything I've wanted to do is supported out of the box. It will save developers porting to sdk v3 a massive headache.

hpagent is recommended by got (https://github.com/sindresorhus/got/blob/main/documentation/tips.md#proxying), for additional context.

Issue using fromCognitoIdentityPool

Hi,

I have installed the package from the documentation but it seems that when I import this:

import { fromCognitoIdentityPool } from "@aws-sdk/credential-providers";

Getting these issues:

`Compiled with problems:X

ERROR in ./node_modules/@aws-sdk/credential-provider-cognito-identity/dist-es/fromCognitoIdentity.js 53:12-36

export 'CredentialsProviderError' (imported as 'CredentialsProviderError') was not found in '@aws-sdk/property-provider' (possible exports: ProviderError, chain, fromStatic, memoize)

ERROR in ./node_modules/@aws-sdk/credential-provider-cognito-identity/dist-es/fromCognitoIdentity.js 57:12-36

export 'CredentialsProviderError' (imported as 'CredentialsProviderError') was not found in '@aws-sdk/property-provider' (possible exports: ProviderError, chain, fromStatic, memoize)

ERROR in ./node_modules/@aws-sdk/credential-provider-cognito-identity/dist-es/fromCognitoIdentity.js 61:12-36

export 'CredentialsProviderError' (imported as 'CredentialsProviderError') was not found in '@aws-sdk/property-provider' (possible exports: ProviderError, chain, fromStatic, memoize)

ERROR in ./node_modules/@aws-sdk/credential-provider-cognito-identity/dist-es/fromCognitoIdentityPool.js 100:12-36

export 'CredentialsProviderError' (imported as 'CredentialsProviderError') was not found in '@aws-sdk/property-provider' (possible exports: ProviderError, chain, fromStatic, memoize)
`

GitHub files out of sync with AWS Documentation?

I was browsing the v3 migration documentation page within the JS SDK documentation, and was going to submit a PR to fix some of the code samples which are currently missing an equals sign in assignment expressions in at least two places.

I was unable to locate the page within this repository, I only saw a V2 migration Markdown file. Pressing the "Edit on GitHub" button at the bottom of the documentation gave me a 404 error in GitHub,

The last modification for the documentation directory occurred nearly a year ago, is that documentation repo out of sync with the AWS documentation that is currently published? Or am I looking in the wrong place? Thank you.

Invalid update per PartiQL example

There seems to be an error in the documentation on how to update an item in DynamoDB using PartiQL.
The documentation gives the following example:

const params = {
  Statement:
    "UPDATE " + tableName + "  SET Producer=? where title=? and year=?",
  Parameters: [{ S: producer1 }, { S: movieTitle1 }, { N: movieYear1 }],
};
try {
  await ddbDocClient.send(new ExecuteStatementCommand(params));
  console.log("Success. Item updated.");
  return "Run successfully"; // For unit tests.
} catch (err) {
  console.error(err);
}

Using this for my code I get the following snippet:

const params = {
  Statement: `UPDATE Payment-${tableName} SET active=? WHERE subscriptionId=?`,
  Parameters: [{ BOOL: false }, { S: subscriptionId }],
};
return await docClient.send(new ExecuteStatementCommand(params));

tableName in this example is the suffix of my amplify-generated DynamoDB. I want to set the attribute active of all Items where subscriptionId equals a given string value to false.

As result I get this:

ValidationException: Statement wasn't well formed, can't be processed: Expected data manipulation
    at throwDefaultError (/var/runtime/node_modules/@aws-sdk/smithy-client/dist-cjs/default-error-handler.js:8:22)
    at deserializeAws_json1_0ExecuteStatementCommandError (/var/runtime/node_modules/@aws-sdk/client-dynamodb/dist-cjs/protocols/Aws_json1_0.js:1593:51)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /var/runtime/node_modules/@aws-sdk/middleware-serde/dist-cjs/deserializerMiddleware.js:7:24
    at async /var/runtime/node_modules/@aws-sdk/middleware-signing/dist-cjs/middleware.js:13:20
    at async StandardRetryStrategy.retry (/var/runtime/node_modules/@aws-sdk/middleware-retry/dist-cjs/StandardRetryStrategy.js:51:46)
    at async /var/runtime/node_modules/@aws-sdk/middleware-logger/dist-cjs/loggerMiddleware.js:6:22
    at async updatePayment (/var/task/index.js:54:12)
    at async exports.handler (/var/task/index.js:125:21) {
  '$fault': 'client',
  '$metadata': {
    httpStatusCode: 400,
    requestId: 'xxx',
    extendedRequestId: undefined,
    cfId: undefined,
    attempts: 1,
    totalRetryDelay: 0
  },
  __type: 'com.amazon.coral.validate#ValidationException'
}

Line 54 is the line where I call docClient.send(..).

How do I retrive unauthenticated Amazon Cognito Identity in V3

Hi,
I am following this document - https://docs.aws.amazon.com/cognito/latest/developerguide/getting-credentials.html which uses SDK-v2 and the following code

var identityId = AWS.config.credentials.identityId;
I am using below V3 code

const { CognitoIdentityClient } = require("@aws-sdk/client-cognito-identity");
const { fromCognitoIdentityPool } = require("@aws-sdk/credential-provider-cognito-identity");
const { Kinesis, PutRecordsCommand } = require("@aws-sdk/client-kinesis");

const REGION = "us-east-1";
const client = new Kinesis({
  region: REGION,
  credentials: fromCognitoIdentityPool({
    client: new CognitoIdentityClient({region: REGION}),
    identityPoolId: "us-east-1:XXXX-XXX-XXX-XXXX" 
    
  })
});

How do I retrive unauthenticated Amazon Cognito Identity in a variable? V2 and V3 is completely different and it's hard to follow.
Thank you for your help.

Why is the published version of the documentation very different than this repo?

There are a few minor fixes that I would like to make a PR for on the published version of the docs (specifically https://github.com/awsdocs/aws-sdk-for-javascript-v3/blob/main/doc_source/dynamodb-example-table-read-write.md):

But this is what I see on the v3 docs page:

Screen Shot 2021-06-23 at 11 39 56 AM

But this is what is on top of master (https://github.com/awsdocs/aws-sdk-for-javascript-v3/blob/846eb3664690104149462f25c869baf99f0ce3fd/doc_source/dynamodb-example-table-read-write.md) :
Screen Shot 2021-06-23 at 11 41 42 AM

They are quite divergent, which makes community contribution to this project impossible.

(Perfectly willing to believe that I'm the idiot and I found an outdated public version of the repo. But then, where is the current/published version that we can fork?)

unable to assume role with environment vars

It seems that functionality is provided to specify the aws_access_key_id and aws_secret_access_key via environment vars, but not role_arn.

In particular, you can specify an AWS_PROFILE to use, which gets the role_arn from the shared config file, so it seems to be just an oversight, as opposed to an intentional decision, ie due to some security issue.

In fact, it seems we can even get half way there currently, by specifying something like

[profile test]
role_arn = arn:aws:iam::.....
credential_source = Environment

So how about the implementing role_arn from environment as well?
And as a logical extension be able to pass them in via the credentials config for the various clients, ie

const sqsClient = new SQSClient({
	credentials: {
		accessKeyId: '...',
		secretAccessKey: '...',
		roleArn: 'arn:aws:iam::...',
	}
});

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.