0

My apologies if this is a stupid question, but I can't seem to find an answer. I'm new to developing Alexa skills, so please excuse my ignorance.

Basically, I want to save the data of multiple users (children) in the same household to a DynamoDB table. The problem I'm running into is that the 'save attributes' process seems to only work if the DynamoDB table uses userId as the Partition Key. This causes only a single record to exist in the table and every time the skill is opened, the data is overwritten by the current user.

How do I get the lambda function to create another record in the table if the userId will always be the same?

Currently, I'm using Node.js and saving a string (name) and an array (items). But as I mentioned earlier, each time the skill is launched, the values are overwritten.

Thanks in advance.

JBenzie
  • 21
  • 5
  • Do all your uses have the same Id? I think you should read [this](https://stackoverflow.com/questions/45581744/how-does-dynamodb-partition-key-works) to know more about partition keys. – yorodm Oct 31 '18 at 18:21
  • When the skill is launched it asks for your name. Ideally, I want each name to be a unique entry in the table. Now, I know there could be multiple users with the same name, but I'm just going this route now for simplicity. The userId is always the same as it's being provided automatically and is associated with my Alexa account (from what I understand). I will def take a look at that, thank you. – JBenzie Oct 31 '18 at 18:24
  • Also, it seems that if I create the table with the partition key as anything other than 'userId', the skill will fail saying "there is a problem with the requested skill's response". – JBenzie Oct 31 '18 at 18:28

1 Answers1

0

So, I think I've answered my own question after some more trial and error. I ended up creating an array of objects and it seems to be working as I had originally expected. It just took me a while to get my head wrapped around it.

Thanks.

JBenzie
  • 21
  • 5