I'm trying to get a local docker instance of localstack/localstack to work with node.js aws-sdk library. But I can get a simple createTopic to work on an sns client.
I have started the docker image with this command and
docker run -d -p 4567-4583:4567-4583 localstack/localstack
The code that I am running....
const AWS = require('aws-sdk')
AWS.config.update({
accessKeyId: 'something',
secretAccessKey: 'something',
region:'us-east-1',
logger: process.stdout
})
const sns = new AWS.SNS({endpoint:'http://localhost::4575'})
sns.createTopic({Name:'testing123'})
.promise()
.then(console.log)
.catch(console.error)
And the error that is returned....
[AWS sns 404 0.035s 0 retries] createTopic({ Name: 'testing123' }) { 404: null at Request.extractError (/Users/t.smith/workspace/scratch/fake-sns-testing/node_modules/aws-sdk/lib/protocol/query.js:52:29) at Request.callListeners (/Users/t.smith/workspace/scratch/fake-sns-testing/node_modules/aws-sdk/lib/sequential_executor.js:105:20) at Request.emit (/Users/t.smith/workspace/scratch/fake-sns-testing/node_modules/aws-sdk/lib/sequential_executor.js:77:10) at Request.emit (/Users/t.smith/workspace/scratch/fake-sns-testing/node_modules/aws-sdk/lib/request.js:683:14) at Request.transition (/Users/t.smith/workspace/scratch/fake-sns-testing/node_modules/aws-sdk/lib/request.js:22:10) at AcceptorStateMachine.runTo (/Users/t.smith/workspace/scratch/fake-sns-testing/node_modules/aws-sdk/lib/state_machine.js:14:12) at /Users/t.smith/workspace/scratch/fake-sns-testing/node_modules/aws-sdk/lib/state_machine.js:26:10 at Request. (/Users/t.smith/workspace/scratch/fake-sns-testing/node_modules/aws-sdk/lib/request.js:38:9) at Request. (/Users/t.smith/workspace/scratch/fake-sns-testing/node_modules/aws-sdk/lib/request.js:685:12) at Request.callListeners (/Users/t.smith/workspace/scratch/fake-sns-testing/node_modules/aws-sdk/lib/sequential_executor.js:115:18) message: null, code: 404, time: 2018-04-23T09:56:50.296Z,
requestId: undefined, statusCode: 404, retryable: false,
retryDelay: 95.466505112399 }
I would like to hear from anyone who has successfully managed to work with a localstack/localstack docker image with node.js. Thanks.
'http://localhost:4575'
(without double :) – Hugodby