alexa-samples / skill-sample-nodejs-audio-player

An Alexa Skill Sample showing how to play long form audio in 3P-skills
Other
470 stars 319 forks source link

Unable to change state to START_MODE #65

Closed JoshiAbhishek closed 6 years ago

JoshiAbhishek commented 6 years ago

I am attempting to allow a returning user who would otherwise be stuck in the RESUME_DECISION_MODE state to return to the START_MODE state. I have attempted to do so by changing the state handler (this.handler.state = constants.states.START_MODE) and listening for user input. However, the state change is never recognized. In the case that I change the state handler and use emitWithState, I am able to send the user to a specific intent in START_MODE, however, whenever I start the skill again, I am brought back to the RESUME_DECISION_MODE state. I believe this may be due to how the current state is being saved, although I am not sure. How can I resolve this to allow users to fully return the START_MODE state from RESUME_DECISION_MODE?

talkingnews commented 6 years ago

What version of the SDK are you using? Does the state get changed in dynamodb? (look at the table) How are you ending the function? Can you try adding this.emit(':saveState', true); before this.emit(':responseReady');

JoshiAbhishek commented 6 years ago

I realized that the problem appears to be due to START_MODE being represented by an empty string in the constants.js file (START_MODE : ''). DynamoDB does not allow storing empty string values (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.NamingRulesDataTypes.html). Therefore, saving state changes works for states represented by non-empty strings.