help writing to dynamodB using Scorekeeper as base sample
I am trying to modify a sample from the Alexa Skills Kit (Scorekeeper) so that it reads a database. I know its some variation of getitem but for the life of me cannot get it working. Maybe ExpressionAttributeValues? The original works-but my modification does not. I wish to have a Partition Key & Sort Key. I am also unclear the role of .data, if this is part of at the dynamodB class or not.I am rather new-And appreciate any suggestions i have attached the original file, and was wondering if someone could take a look and determine would be the correct variation of getitem or expression. I am using the Lamba and following the instructions for setup provided
Hi Daniel, Welcome to dev forums and thanks for posting! You forgot to attach the file you mentioned. Regardless, if you are new to technology and got stuck, the first thing to do in a situation like this is to start with the sample that you know works fine. Then modify one thing at a time and re-test, making sure it still works. Whenever it breaks, you know that the last thing you changed is the thing that most likely caused the problem, so then troubleshoot that particular line/section. Hopefully that way you can isolate the issue. Feel free to post whatever you find. Thanks!
Hello Levon, I working thru the Alexa skill samples and am really struggling to get ScoreKeeper to work. I can get the voice part working but the players and game do not appear to be saved. Each time I started a game with some players added, I still get a response that no player has joined. I think the data was never stored to DynamoDB. I followed everything in the README and used the code as provided without change. Is there anything missing in the README or obvious place I should check? I started a thread in the Forum yesterday but have not heard from anyone yet. I am a complete newbie to Alexa and AWS. don't know who else to turn to. Any help you can provided is much appreciated.
Made a little progress today. Followed the instructions for the first two parts given in the following link that was posted earlier on this thread, I was able to update a DynamoDB table with code:
https://snowulf.com/2015/08/05/tutorial-aws-api-gateway-to-lambda-to-dynamodb/ (Note - Use the first set of code in the gist link and I had to change the timedate, longitude and latitude parameters to "S".) Was able to observe data entered into the DynamoDB table either by entering the code in the "edit code inline" or as an uploaded zip file. Learned a lot by playing around with the code and did a lot of console.log() additions and looking at the log output. Next, I attempted to add this snippet of putItem() code into the helloWorld skill code to see if can do the same thing since the ScoreKeeper appears to be too complicated for this experiment. However, when I added the code to the helloWorld skill, I found that I never got the callback from the putItem() request. Maybe that is why we couldn't get Scorekeeper to work since the DynamoDB request callbacks were never made!!! I don't know what else to do and it is getting late. Maybe I will try some other things tomorrow. Please let me know if you made any progress. Wish someone from Amazon is monitoring this and offer some help.
All the forum monitors would do is tell you to post on the DynamoDB problem, or refer to you DynamoDB documentation. Sounds like your problems have to do with knowledge of DynamoDB, not an Alexa bug. They're pretty siloed in Amazon. I can't say much. I had DynamoDB working with node.js in Lambda. But the latency was too high and my Lambda skill was spending too much of its time budget on DB calls (two read, two write). So I switched to a servlet. Now I make my DynamoDB calls from Java. So I can cache the reads, and push the writes onto a different thread. But, overall, DynamoDB is not for the faint hearted. I just hit their doc hard, searched stack overflow, workout how to do what I wanted to do, and then wrapped it behind a much easier to use API. Amazon is being somewhat disingenuous with these "write a skill in an hour" articles.
I have been looking at all the documentation I can find and it is helping somewhat. I am using Node.js but could not find an API doc for Node.js to access DynamoDB. I am piecing things together slowly. Thanks for sharing your experience. For now, I want to stick with Node.js since that is an area I want to learn more about. Tough to try to learn Node.js and DynamoDB at the same time. Sounds like I am going to have to do the same thing you are doing in Node.js. What worries me is why I am getting the DynamoDB callback with straight Node.js code but does not get a callback when I added that code into an environment where I am using the AlexaSkill. Could be my lack of understanding of Node.js and how the callback from DynamoDB works. Hope someone can shed light on that.
Same here. I want to learn DynamoDB, which is the only reason I went this route. I had hoped the Alexa samples provided would help bring more light on the subject, but even that caused more issues. I can always just use SQL on my own server to store values and make it all work for me internally, but that is not the direction I want to take. I really just want to learn. With that I will just dive into DynamoDB itself.
I think what you really want is not Alexa samples, but DynamoDB samples. I found the DynamoDB documentation comprehensive, although hard to get through. StackOverflow would be your best bet. But focus on DynamoDB + nodejs, and don't put in Alexa as a search term. I think that will narrow it too much. You might even play around trying to get pure nodejs code to work, outside of an Alexa environment. That would give you a quicker turnaround. Or did I miss something, and you already tried this? If so, then sounds like the problem is more to do with Lambda. Look for Lambda examples.
Yes, I am just going to concentrate on DynamoDB and node.js, leaving out Alexa for the time being. Learn each piece instead of tying it all together for now. StackOverflow has a lot of help for just about everything, so I will definitely go that route. Thanks!