Closed jackstevenson closed 4 years ago
Looking into this a little further it's possible to enable connection keep-alive by setting an environment variable. From the docs:
The easiest way to configure SDK for JavaScript to reuse TCP connections is to set the AWS_NODEJS_CONNECTION_REUSE_ENABLED environment variable to 1.
It might be preferable to use this built-in config and defer to the SDK for agent configuration rather than having a keepAlive
option in this lib. If that's not the case you would need to configure an http.Agent
and conditionally set the httpOptions
based on the sslEnabled
option - essentially duplicating what the SDK already does.
In addition to this, the sslEnabled
and region
options could be removed as it's possible to pass these in to the RDSDataService
using the already available options
param.
Example config:
const dataClient = require('data-api-client')({
resourceArn: '*******',
secretArn: '*******',
database: '*******',
options: {
endpoint: 'localhost:8080',
sslEnabled: false,
region: 'eu-west-1',
},
});
sslEnabled: false
for local dev fails with the following error'Protocol "http:" not supported. Expected "https:"'
. To work around this issue you must also disablekeepAlive
to prevent the custom httpsAgent being configured