Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connecting from Browser SDK #4

Closed
grvhi opened this issue Feb 5, 2015 · 14 comments
Closed

Connecting from Browser SDK #4

grvhi opened this issue Feb 5, 2015 · 14 comments

Comments

@grvhi
Copy link

grvhi commented Feb 5, 2015

I'm hoping to use Kinesalite to test my web app locally (using the AWS JS SDK, I post data to Kinesis from the browser).

I've started Kinesalite using kinesalite 4567 in my terminal and in my browser config I have:

var ep = new AWS.Endpoint('https://127.0.0.1:4567');
var kinesis = new AWS.Kinesis({endpoint: ep});

But the SDK of course complains about missing credentials and region settings. Is what I'm trying to achieve possible?

Thanks

@mhart
Copy link
Owner

mhart commented Feb 5, 2015

It might be - I'm a little rusty on the SDK itself, but it seems that it's the one complaining, not kinesalite itself, so it's probably just a matter of supplying some credentials and region.

What happens if you do:

var kinesis = new AWS.Kinesis({
  endpoint: new AWS.Endpoint('https://127.0.0.1:4567'),
  region: 'us-east-1',
  accessKeyId: 'akid',
  secretAccessKey: 'secret',
})

Or:

AWS.config.update({region: 'us-east-1', accessKeyId: 'akid', secretAccessKey: 'secret'})

var kinesis = new AWS.Kinesis({endpoint: new AWS.Endpoint('https://127.0.0.1:4567')})

@grvhi
Copy link
Author

grvhi commented Feb 6, 2015

Thanks @mhart - I'm now getting the SSL cert error (refuses to accept the SSL cert). Have tried using http:// and setting enableSSL: false, but that gives me a connection dropped error instead. I'm going to try using the code from here #3 to see if that solves the issue for me.

@grvhi
Copy link
Author

grvhi commented Feb 6, 2015

@mhart - PR #3 works a charm for me. However, I'm now suffering from CORS errors.... I've tried adding the correct headers to the node http server, but not getting anywhere. Any chance you can point me in the right direction? Thanks again.

@mhart
Copy link
Owner

mhart commented Feb 6, 2015

Hmmm, that's a good point. I think adding headers is the right way to go, but might need some playing around.

I don't have much time in the next few days unfortunately, but I'll be on a place Monday, so will have plenty of time to look into it then (and I'll merge PR #3 in, or some variant of it)

@grvhi
Copy link
Author

grvhi commented Feb 6, 2015

Super, thanks @mhart. Much appreciated. Trying to get my local test env up and running and emulating Kinesis is the final piece of the puzzle!

Bit bemused that AWS haven't released something like this (as they did with DynamoDBLocal)....

@grvhi
Copy link
Author

grvhi commented Feb 13, 2015

@mhart - did you have a chance to take a look at this?

@mhart
Copy link
Owner

mhart commented Feb 24, 2015

Hey, sorry for the delay, just merged #3 and will look into the CORS stuff now

@mhart
Copy link
Owner

mhart commented Feb 24, 2015

Fixed in v0.6.0

@mhart mhart closed this as completed Feb 24, 2015
@mhart
Copy link
Owner

mhart commented Feb 24, 2015

(oh, and thanks for filing the issue!)

@grvhi
Copy link
Author

grvhi commented Feb 24, 2015

Brilliant, thanks @mhart - will try it out a little later. Going to be really helpful!

@mhart
Copy link
Owner

mhart commented Feb 24, 2015

Well... I'm sure it will be as soon as I've actually finished implementing GetRecords :-)

@grvhi
Copy link
Author

grvhi commented Feb 24, 2015

Selfishly, I'm only interested in PutRecord.....!

@mhart
Copy link
Owner

mhart commented Feb 24, 2015

Oh awesome, well you should be covered then 👍

@mhart
Copy link
Owner

mhart commented Oct 12, 2015

Just to update from a question posed at #17 – you no longer need an explicit AWS.Endpoint and can just do:

var kinesis = new AWS.Kinesis({endpoint: 'http://localhost:4567'})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants