Skip to content

Commit 4d886c2

Browse files
AllanZhengYPtrivikr
andcommitted
docs: address feedbacks
Co-authored-by: Trivikram Kamat <[email protected]>
1 parent 924fa37 commit 4d886c2

File tree

2 files changed

+42
-23
lines changed

2 files changed

+42
-23
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ It returns a function that accepts args, an object that contains the parameters
135135

136136
#### Other Changes
137137

138-
If you are looking for a breakdown of the API changes from v2 to v3, we have them listed in [UPGRADING.md](./UPGRADING.md).
138+
If you are looking for a breakdown of the API changes from AWS SDK for JavaScript v2 to v3,
139+
we have them listed in [UPGRADING.md](./UPGRADING.md).
139140

140141
### Install from Source
141142

UPGRADING.md

Lines changed: 40 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
# Upgrading Notes (2.x to 3.x)
22

3-
This document captures notable changes from v2 SDK to v3 SDK, as known as modular JavaScript SDK for AWS.
3+
This document captures notable changes from AWS SDK for JavaScript v2 to v3.
4+
The v3 is also known as modular AWS SDK for JavaScript.
45

56
Because v3 is a modular rewrite of v2, some basic conceptions are different between v2 and v3. You can learn about
6-
these changes in our fast growing list of [blog posts](https://aws.amazon.com/blogs/developer/category/developer-tools/aws-sdk-for-javascript-in-node-js/). Among the blog posts, The following 2 will get you up-to-speed:
7+
these changes in our [blog posts](https://aws.amazon.com/blogs/developer/category/developer-tools/aws-sdk-for-javascript-in-node-js/).
8+
The following blog posts will get you up to speed:
79

8-
- [modular packages](https://aws.amazon.com/blogs/developer/modular-packages-in-aws-sdk-for-javascript/)
9-
- [middleware stack](https://aws.amazon.com/blogs/developer/first-class-typescript-support-in-modular-aws-sdk-for-javascript/)
10+
- [Modular packages in AWS SDK for JavaScript](https://aws.amazon.com/blogs/developer/modular-packages-in-aws-sdk-for-javascript/)
11+
- [Introducing Middleware Stack in Modular AWS SDK for JavaScript](https://aws.amazon.com/blogs/developer/first-class-typescript-support-in-modular-aws-sdk-for-javascript/)
1012

11-
Bellow are a summary of interface changes from v2 to v3 SDK. The goal is to help you easily find the v3 equivalents of
12-
the v2 APIs you are already familiar with.
13+
The summary of interface changes from AWS SDK for JavaScript v2 to v3 is given below.
14+
The goal is to help you easily find the v3 equivalents of the v2 APIs you are already familiar with.
1315

1416
## Client Constructors
1517

16-
This list is indexed by [parameters in v2 SDK](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Config.html). For
17-
options shown as `Planned` in v3, they are confirmed to be supported, but no timeline can be shared at the moment. They
18+
This list is indexed by [v2 config parameters](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Config.html). For
19+
options shown as `Planned` in v3, they will be supported but no timeline can be shared at the moment. They
1820
might not have the same name either.
1921

2022
- [`computeChecksums`](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Config.html#computeChecksums-property)
@@ -34,8 +36,8 @@ might not have the same name either.
3436
- **v3**: No change.
3537
- [`credentials`](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Config.html#credentials-property)
3638
- **v2**: The AWS credentials to sign requests with.
37-
- **v3**: No change. It can also be an async function that returns a credential.
38-
See [v3 reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/interfaces/_aws_sdk_middleware_signing.awsauthinputconfig-1.html#credentials)
39+
- **v3**: No change. It can also be an async function that returns credentials.
40+
See [v3 reference for AwsAuthInputConfig credentials](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/interfaces/_aws_sdk_middleware_signing.awsauthinputconfig-1.html#credentials).
3941
- [`endpointCacheSize`](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Config.html#endpointCacheSize-property)
4042
- **v2**: The size of the global cache storing endpoints from endpoint discovery operations.
4143
- **v3**: Not available. Planned. This option configures endpoint discovery behavior, which is not yet available in v3.
@@ -47,9 +49,11 @@ might not have the same name either.
4749
- **v3**: **Deprecated**. SDK _always_ injects the hostname prefix when necessary.
4850
- [`httpOptions`](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Config.html#httpOptions-property)
4951

50-
A set of options to pass to the low-level HTTP request. These options are aggregated differently in V3. You can
52+
A set of options to pass to the low-level HTTP request. These options are aggregated differently in v3. You can
5153
configure them by supplying a new `requestHandler`. Here's the example of setting http options in Node.js runtime. You
52-
can find more in [v3 reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/classes/_aws_sdk_node_http_handler.nodehttphandler-1.html).
54+
can find more in [v3 reference for NodeHttpHandler](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/classes/_aws_sdk_node_http_handler.nodehttphandler-1.html).
55+
56+
All v3 requests use HTTPS by default. You only need to provide custom httpsAgent.
5357

5458
```javascript
5559
const { Agent } = require("https");
@@ -60,17 +64,30 @@ might not have the same name either.
6064
httpsAgent: new Agent({
6165
/*params*/
6266
}),
63-
httpAgent: new HttpAgnet({
64-
/*params*/
65-
}),
6667
connectionTimeout: /*number in milliseconds*/
6768
socketTimeout: /*number in milliseconds*/
6869
}),
6970
});
7071
```
7172

72-
If the client is suppose to run in browsers, a different set of options is available. You can find more in [v3
73-
reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/classes/_aws_sdk_fetch_http_handler.fetchhttphandler-1.html).
73+
If you are passing custom endpoint which uses http, then you need to provide httpAgent.
74+
75+
```javascript
76+
const { Agent } = require("http");
77+
const { NodeHttpHandler } = require("@aws-sdk/node-http-handler");
78+
79+
const dynamodbClient = new DynamoDBClient({
80+
requestHandler: new NodeHttpHandler({
81+
httpAgent: new Agent({
82+
/*params*/
83+
}),
84+
}),
85+
endpoint: "http://example.com",
86+
});
87+
```
88+
89+
If the client is running in browsers, a different set of options is available. You can find more in [v3
90+
reference for FetchHttpHandler](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/classes/_aws_sdk_fetch_http_handler.fetchhttphandler-1.html).
7491

7592
```javascript
7693
const { FetchHttpHandler } = require("@aws-sdk/fetch-http-handler");
@@ -81,15 +98,15 @@ might not have the same name either.
8198
});
8299
```
83100

84-
Each option of `httpOptions` is specified bellow:
101+
Each option of `httpOptions` is specified below:
85102

86-
- `httpOptions.proxy`
103+
- `proxy`
87104
- **v2**: The URL to proxy requests through
88-
- **v3**: You can set up a proxy with an agent following [this guide](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-proxies.html)
105+
- **v3**: You can set up a proxy with an agent following [Configuring proxies for Node.js](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-proxies.html)
89106
- `agent`
90107

91108
- **v2**: The Agent object to perform HTTP requests with. Used for connection pooling.
92-
- **v3**: You can configure `httpAgent` or `httpsAgent` like in the examples above.
109+
- **v3**: You can configure `httpAgent` or `httpsAgent` as shown in the examples above.
93110

94111
- `connectionTimeout`
95112
- **v2**: Sets the socket to timeout after failing to establish a connection with the server after connectTimeout
@@ -114,7 +131,8 @@ might not have the same name either.
114131
- **v3**: **Deprecated**. SDK _does not_ follow redirects to avoid unintentional cross-region requests.
115132
- [`maxRetries`](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Config.html#maxRetries-property)
116133
- **v2**: The maximum amount of retries to perform for a service request.
117-
- **v3**: Changed to `maxAttempts`. See more in [v3 reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/interfaces/_aws_sdk_middleware_retry.retryinputconfig-2.html#maxattempts). Note that the `maxAttempt` should be `maxRetries` + 1.
134+
- **v3**: Changed to `maxAttempts`. See more in [v3 reference for RetryInputConfig](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/interfaces/_aws_sdk_middleware_retry.retryinputconfig-2.html#maxattempts).
135+
Note that the `maxAttempt` should be `maxRetries + 1`.
118136
- [`paramValidation`](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Config.html#paramValidation-property)
119137
- **v2**: Whether input parameters should be validated against the operation description before sending the request.
120138
- **v3**: **Deprecated**. SDK _does not_ do validation on client-side at runtime.

0 commit comments

Comments
 (0)