alexa / alexa-skills-kit-sdk-for-nodejs

The Alexa Skills Kit SDK for Node.js helps you get a skill up and running quickly, letting you focus on skill logic instead of boilerplate code.
Apache License 2.0
3.12k stars 736 forks source link

Local testing with Dynamo DB #139

Closed daemonsy closed 6 years ago

daemonsy commented 7 years ago

Hey Amazon, thanks for the ASK SDK. It made skill development much nicer.

I made a skill for NYC's subway and implemented some tests.

The next feature I wanted to add was persisting state and it seems that I should be able to write some tests using DynamoDB local. I was wondering if there's any way to expose the dynamo client so we can use a local client by via something like new AWS.DynamoDB({ endpoint: <local endpoint> }). This will make the skill testing much more meaningful.

Also, if you're willing to accept PRs, happy to take a stab at this.

daemonsy commented 7 years ago

Hi, I added a very naive PR for this.

https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/pull/140

daemonsy commented 7 years ago

Anyone had a chance to take a look at this?

abhilash1in commented 7 years ago

@daemonsy Does the official SDK support alexa.dynamoDBClient?

daemonsy commented 7 years ago

The official one doesn't, this is the PR #140 to attempt to add support for it

jhurliman commented 7 years ago

Allowing a custom AWS client to be passed in would also make this library compatible with AWS X-Ray (see https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-nodejs-awssdkclients.html).

daemonsy commented 6 years ago

hi, thanks everyone for the interest on this. I haven't heard anything from Amazon yet. It originally came with a PR, but now so much time's passed, not sure if the PR still works anymore.

I will strongly advise not to use my branch.

Adding another ping for Amazon here. @Amazon-tianrenz

tianrenz commented 6 years ago

Hi all,

thanks for all the discussion on this thread. The latest SDK release 1.0.25 has enabled developer to inject their own dynamoDB client.

Regards

adamgruber commented 6 years ago

@Amazon-tianrenz Is there documentation or an example for how to inject a local dynamoDB client for testing?

tianrenz commented 6 years ago

Hi @adamgruber,

We currently do not have such a sample. But now it's very easy to inject your own DynamoDB client into the DynamoDBPersistenceAdapter (see here). You can setup your local DynamoDB follow this link. And then in your DynamoDBClient, just set the endpoint to point to local host.

Regards