question

newuser-0dab0304-4519-4602-870e-d0495a8edc38 avatar image

Adding new Intent breaks functionality of an unrelated intent (even w/o lambda function added)

I'm having an issue with new intents breaking a specific intent in my skill(the endrecordingIntent), even though their logic is completely independent. I tested out adding a new dummy intent (through the aws front end sdk) whose logic i haven't even included in lambda aws and saw the same error of "there was a problem in your requested skills response" instead of the expected outcome. I have no idea what could be going wrong at this point, any tips on what could be causing the issue are appreciated. See code below. Thanks!

"use strict";
var Alexa = require("alexa-sdk"); <br>var AWS = require('aws-sdk'); <br>const APP_ID = 'amzn1.ask.skill.6f4eefbb-f0aa-474f-82c6-9394bcb2335c'; <br>var ddb = new AWS.DynamoDB.DocumentClient(); <br>var userLocation;
  var handlers = {
      'LaunchRequest': function(){
        this.emit(":ask", "Welcome to seizure support, a voice enabled seizure tracker, say your location to complete setup."); <br>      },
      'citiesIntent': function(){<br>// user responds with their city location after the onLaunch event. After this point, the //                // stopRecordingIntent doesn't work - recordIntent and seizureTypeIntent both still function // <br>// userLocation = this.event.request.intent.slots.UScity.value; <br>// this.response.speak(userLocation + " has been set"); <br>// this.emit(':responseReady'); <br>        }, 'recordIntent': async function() {
          var date = new Date(); <br>          var startTime = `${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
          var dateStamp = `${date.getMonth()}-${date.getDate()}-${date.getFullYear()}`;
          this.attributes['startTime'] = startTime;
          this.attributes['date'] = dateStamp;
          var params = {
            TableName: '######', <br>            Item:{
                 "startTime": this.attributes['startTime'], <br>                 "date": dateStamp,
            }
          };
          await ddb.put(params,(err,data)=>{
            if (err){
              console.log(err)
            }else{
              console.log(data)
            } 
          }).promise(); <br>this.emit(":ask", "Recording"); <br> },'stopRecordingintent': async function(){<br>//failure is here //<br>          var date = new Date();
          var endTime = `${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`; <br>            var params = {
              TableName:'#######',
              Key:{
                startTime : this.attributes['startTime'],
                date      : this.attributes['date']
              },<br>UpdateExpression: "set endTime =:endTime",
              ExpressionAttributeValues:{
                ":endTime":endTime
              },
              ReturnValues:"UPDATED_NEW"
            }; <br>            await ddb.update(params,(err,data)=>{
            if (err){
              this.response.speak(err);
              this.emit(':responseReady');
            }else{
              this.emit(":ask", "Ending recording, say seizure type or skip to end session.");
            }
          }).promise(); <br>        },'seizureTypeintent': async function(){ <br>            var date = new Date(); <br>            var seizureCategory = this.event.request.intent.slots.seizure.value; <br>            var params = {
              TableName:'#########',
              Key:{
                startTime : this.attributes['startTime'],
                date      : this.attributes['date']
              },
              UpdateExpression: "set seizureType =:seizureType",
              ExpressionAttributeValues:{
                ":seizureType": seizureCategory
              },
              ReturnValues:"UPDATED_NEW"
            }; <br>            await ddb.update(params,(err,data)=>{
            if (err){
              console.log(err)
            }else{
              this.response.speak("Information has been recorded.")
              this.emit(':responseReady');
            }
          }).promise();
        //end 
        }<br>}<br>exports.handler = function(event, context, callback){
    var alexa = Alexa.handler(event, context);
        alexa.appId = APP_ID;
        alexa.registerHandlers(handlers);
        alexa.execute();
};
alexa skills kitalexalambdadynamodb
1 comment
10 |5000

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

If you add a new intent, you need a handler on the lambda backend. Otherwise, alexa will not know how to handle the request. I'm guessing the new intent is being called somehow.

0 Likes 0 ·

0 Answers