question

newuser-64a41272-f9be-4eda-8d84-71a5b807515c avatar image
newuser-64a41272-f9be-4eda-8d84-71a5b807515c asked ·

Cannot access data from dynamodb

Hi there,

I am working on a custom alexa skill for the first time.I have done the work for developer console and the intent handlers in lambda is also working using ask-sdk.I am using the aws-sdk to access the dynamodb data via get and update function but the response then starts to give an error.

I have written the get and update function and am calling it from the handlers.How can we integrate these functions and the handlers.

Can you please help me by any code example or tutorial?

alexa skills kitlambdaawsdynamodb
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Oliver@Amazon avatar image
Oliver@Amazon answered ·

If you are using ASK SDK, they have attribute manager which you can use to manage persistent attributes in your DynamoDB table.

To get started on persistent attributes, below is a tech doc you can read!

https://ask-sdk-for-nodejs.readthedocs.io/en/latest/Managing-Attributes.html#attributesmanager

Below is a sample of a game where they store the last guessed number in the table.

https://github.com/alexa/skill-sample-nodejs-highlowgame/blob/master/lambda/custom/index.js

10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

newuser-64a41272-f9be-4eda-8d84-71a5b807515c avatar image
newuser-64a41272-f9be-4eda-8d84-71a5b807515c answered ·

Cant we use aws-sdk to access the data in ask sdk?I have provided with the code snap.Can you tell me what the issue is? in accessing data this way

snap17.png


snap17.png (24.5 KiB)
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Rokas avatar image
Rokas answered ·

Call to the dynamo is async, so you need to wait for the response to arrive from it before continuing with the code. In this thread developer had a similar issue.

10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.