Skip to content

Commit

Permalink
Apply changes shipped by AWS' version
Browse files Browse the repository at this point in the history
  • Loading branch information
rchl committed Feb 22, 2022
1 parent 1107c27 commit 4ec7b3a
Show file tree
Hide file tree
Showing 22 changed files with 868 additions and 648 deletions.
44 changes: 0 additions & 44 deletions CHANGES.txt

This file was deleted.

80 changes: 76 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,24 @@ To quickly use DAX, replace `AWS.DynamoDB` with `AmazonDaxClient`:
const AmazonDaxClient = require('amazon-dax-client');

// Replace this ...
var ddb = new AWS.DynamoDB({region: region});
const ddb = new AWS.DynamoDB({region: region});
/// with this ...
var dax = new AmazonDaxClient({endpoints: [endpoint], region: region});
const endpoint = "your-cluster-discovery-endpoint";
const dax = new AmazonDaxClient({endpoints: [endpoint], region: region});

// If using AWS.DynamoDB.DocumentClient ...
var doc = new AWS.DynamoDB.DocumentClient({service: dax});
const doc = new AWS.DynamoDB.DocumentClient({service: dax});
```

The DAX endpoint can be found the AWS console or by using `aws dax describe-clusters` from the command line.
The DAX Cluster Discovery Endpoint can be found the AWS console or by using `aws dax describe-clusters` from the command line.

Creating a connection to your DAX cluster requires using the Cluster Discovery Endpoint URL returned in the DescribeClusters response as the endpoint.

For example:
```javascript
// Format: const endpoint = <ClusterDiscoveryEndpoint.URL>;
const endpoint = 'dax://my-cluster.abc123.dax-clusters.us-east-1.amazonaws.com';
```

## Getting Help
Please use these community resources for getting help.
Expand All @@ -38,3 +47,66 @@ Please use these community resources for getting help.
* Ask a question on [the AWS DynamoDB forum](https://forums.aws.amazon.com/forum.jspa?forumID=131&start=0)
* Open a support ticket with [AWS Support](https://console.aws.amazon.com/support/home#/)


## Changes

#### 1.2.7
* AuthenticationRequiredException is a retryable request
* Improved request routing, connection management and retry logic

#### 1.2.6
* Add support for TLS and encrypted DAX clusters

#### 1.2.5
* Lock antlr4 to 4.8.x to avoid breaking application running older node version when upgrading to 4.9.0
* Replace use of deprecated Buffer constructors

#### 1.2.4
* Minor bug fixes.

#### 1.2.3
* Retry prefer to choose a different node.
* Adjust exponential back off delay and strategy.

#### 1.2.2
* Fix unrecoverable request timeout after DAX node restart.
* Fix connection timeout during DAX server restart.
* Allow retry for IO exceptions.
* Remove verbose connection error logs.
* Fix empty string encoding bug.

#### 1.2.1
* Bug fix in TransactionGetItems Api to return Key element correctly.

#### 1.2.0
* Support for DynamoDB Transaction Apis.
* Fix excessive background endpoint refresh calls.

#### 1.1.4
* Fix connection leaks on timeout.
* Support configurable requestTimeout. (Default: 60s)

#### 1.1.3
* Fix transient error on tube cleanup
* Fix UpdateItem result parsing with a subset of attributes changed
* Increase default connectTimeout and make it configurable

#### 1.1.2
* Fix socket leaks on validation errors
* Fix SocketTimeout caused by connection establishment
* Fix issue with update response if the item is not changed
* Fix error decoding BatchWrite UnprocessedItems.

#### 1.1.1
* Fix socket leaks on errors

#### 1.1.0
* Brand new decoder for improved performance on large results
* Improved connection/timer management to allow clean exit on Lambda

#### 1.0.2
* Improved connection/timer management to allow clean exit on Lambda

#### 1.0.1
* Initial release

44 changes: 44 additions & 0 deletions generated-src/Stubs.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ exports.write_authorizeConnection_1489122155_1 = function(accessKeyId, signature
tube.flush();
}).catch((err) => {
tube.close();
// For IO exception, make it retryable.
if(err && err.code === 'EPIPE') {
throw new DaxClientError(err.message, DaxErrorCode.Connection, true);
}
throw err;
});
};
Expand All @@ -53,6 +57,10 @@ exports.write_defineAttributeList_670678385_1 = function(attributeListId, tube)
tube.flush();
}).catch((err) => {
tube.close();
// For IO exception, make it retryable.
if(err && err.code === 'EPIPE') {
throw new DaxClientError(err.message, DaxErrorCode.Connection, true);
}
throw err;
});
};
Expand All @@ -68,6 +76,10 @@ exports.write_defineAttributeListId_N1230579644_1 = function(attributeNames, tub
tube.flush();
}).catch((err) => {
tube.close();
// For IO exception, make it retryable.
if(err && err.code === 'EPIPE') {
throw new DaxClientError(err.message, DaxErrorCode.Connection, true);
}
throw err;
});
};
Expand All @@ -83,6 +95,10 @@ exports.write_defineKeySchema_N742646399_1 = function(tableName, tube) {
tube.flush();
}).catch((err) => {
tube.close();
// For IO exception, make it retryable.
if(err && err.code === 'EPIPE') {
throw new DaxClientError(err.message, DaxErrorCode.Connection, true);
}
throw err;
});
};
Expand All @@ -108,6 +124,10 @@ exports.write_deleteItem_1013539361_1 = function(request, tube) {
tube.flush();
}).catch((err) => {
tube.close();
// For IO exception, make it retryable.
if(err && err.code === 'EPIPE') {
throw new DaxClientError(err.message, DaxErrorCode.Connection, true);
}
throw err;
});
};
Expand All @@ -121,6 +141,10 @@ exports.write_endpoints_455855874_1 = function(tube) {
tube.flush();
}).catch((err) => {
tube.close();
// For IO exception, make it retryable.
if(err && err.code === 'EPIPE') {
throw new DaxClientError(err.message, DaxErrorCode.Connection, true);
}
throw err;
});
};
Expand All @@ -146,6 +170,10 @@ exports.write_getItem_263244906_1 = function(request, tube) {
tube.flush();
}).catch((err) => {
tube.close();
// For IO exception, make it retryable.
if(err && err.code === 'EPIPE') {
throw new DaxClientError(err.message, DaxErrorCode.Connection, true);
}
throw err;
});
};
Expand Down Expand Up @@ -173,6 +201,10 @@ exports.write_putItem_N2106490455_1 = function(request, tube) {
tube.flush();
}).catch((err) => {
tube.close();
// For IO exception, make it retryable.
if(err && err.code === 'EPIPE') {
throw new DaxClientError(err.message, DaxErrorCode.Connection, true);
}
throw err;
});
};
Expand Down Expand Up @@ -204,6 +236,10 @@ exports.write_query_N931250863_1 = function(request, tube) {
tube.flush();
}).catch((err) => {
tube.close();
// For IO exception, make it retryable.
if(err && err.code === 'EPIPE') {
throw new DaxClientError(err.message, DaxErrorCode.Connection, true);
}
throw err;
});
};
Expand All @@ -227,6 +263,10 @@ exports.write_scan_N1875390620_1 = function(request, tube) {
tube.flush();
}).catch((err) => {
tube.close();
// For IO exception, make it retryable.
if(err && err.code === 'EPIPE') {
throw new DaxClientError(err.message, DaxErrorCode.Connection, true);
}
throw err;
});
};
Expand All @@ -252,6 +292,10 @@ exports.write_updateItem_1425579023_1 = function(request, tube) {
tube.flush();
}).catch((err) => {
tube.close();
// For IO exception, make it retryable.
if(err && err.code === 'EPIPE') {
throw new DaxClientError(err.message, DaxErrorCode.Connection, true);
}
throw err;
});
};
Expand Down
23 changes: 12 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "amazon-dax-client",
"version": "1.2.1",
"version": "1.2.7",
"description": "Amazon DAX Client for JavaScript",
"license": "Apache-2.0",
"homepage": "https://aws.amazon.com/dynamodb/dax/",
Expand All @@ -21,9 +21,10 @@
"generated-src"
],
"scripts": {
"lint": "eslint --ext .js src/",
"lint": "eslint --ext .js src/ generated-src/",
"lint-fix": "eslint --ext .js src/ generated-src/ --fix",
"scanjs": "eslint --ext .js --no-eslintrc -c .scanjs-eslintrc src/ generated-src/ ",
"lint-test": "eslint --ext .js test/",
"lint-test-fix": "eslint --ext .js test/ --fix",
"retire": "retire -p",
"codegen": "PYTHONPATH=codegen/.pip python3 codegen/codegen.py models templates generated-src",
"build-tarball": "./bin/build-package.sh",
Expand All @@ -34,26 +35,26 @@
"test-perf": "node_modules/mocha/bin/mocha test/baseline/ --no-timeouts",
"test-sanity": "node_modules/mocha/bin/mocha test/integration/SanityTest.js --no-timeouts",
"coverage-integration": "nyc mocha test 'test/integration/!(SanityTest*).js'",
"coverage-all": "nyc mocha test test/integration --no-timeouts"
"coverage-all": "nyc mocha test test/integration --no-timeouts",
"release:local": "npm run lint && npm run test"
},
"devDependencies": {
"adm-zip": "^0.4.7",
"babel-eslint": "^7.2.3",
"bluebird": "^3.5.1",
"chai": "~3.5.0",
"chai-as-promised": "~6.0.0",
"chai": "~4.2.0",
"chai-as-promised": "~7.1.1",
"console.table": "^0.10.0",
"eslint": "^3.19.0",
"eslint-config-scanjs": "github:mozfreddyb/eslint-config-scanjs",
"eslint": "^6.7.2",
"eslint-plugin-no-unsafe-innerhtml": "^1.0.16",
"mocha": "^5.2.0",
"nyc": "^11.2.1",
"nyc": "^14.1.0",
"retire": "^1.4.0",
"sinon": "^2.4.1"
},
"dependencies": {
"antlr4": "^4.7.0",
"aws-sdk": ">=2.818.0",
"antlr4": "4.8.x",
"aws-sdk": ">=2.365.0",
"bignumber.js": "^3.0.0",
"jmespath": "^0.15.0",
"uuid": "^3.3.2"
Expand Down

0 comments on commit 4ec7b3a

Please sign in to comment.