victorquinn/dynasty

SSL error when connecting to a local DynamoDB instance

mdonnellyli opened this issue · 2 comments

When trying to access a local instance of DynamoDB we are getting an error connecting

Sample Code
`var credentials = {
accessKeyId: '',
secretAccessKey: '<YOUR_SECRET_ACCESS_KEY>'
};
var dynasty = require('dynasty')(credentials, 'localhost:8000');

var user = dynasty.table('Music'),
promise = user.find('No One You Know');
console.log(promise)
promise.then(function(user) {
console.log('********')
console.log(user)
});
`

Error

`Promise {
_bitField: 0,
_fulfillmentHandler0: undefined,
_rejectionHandler0: undefined,
_progressHandler0: undefined,
_promise0: undefined,
_receiver0: undefined,
_settledValue: undefined }
Unhandled rejection Error: write EPROTO 140735176974336:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:794:

at exports._errnoException (util.js:907:11)
at WriteWrap.afterWrite (net.js:785:14)`

Solved it with this:

var dynasty = require('dynasty')(credentials, 'http://localhost:8000');

Ahh good catch, I should add something like that to the docs. When the protocol is omitted, it assumes https which won't play nicely on a local instance like that. Sorry for the frustration!