0
votes

I'm getting this error when submitting for alexa skill certification:

"The skill must close when using the exist command without returning an error response."

The skill does not close the session or respond appropriately when users say "exit". Instead, the skill returns an error response. Please make sure the skill does not return errors when receiving SessionEndedRequests sent by Alexa.

Already checked the skill for any issues, and there are no errors. I tried command "Exit", and found an error like "

There was a problem with the requested skill's response

Can you please help me to fix this issue. I already have AMAZON.StopIntent which manage the stop request. All sessions are closed with, .withShouldEndSession(true) but still the issue is there for certification. I tried to add "exit" utterance in the AMAZON.StopIntent and still not solved my problem. Any ideas?

Thank you!

1

1 Answers

0
votes

Alexa developer must include Request Handler as below,

  • HelpIntentHandler ()
  • CancelAndStopIntentHandler ()
  • SessionEndedRequestHandler ()

And also a Error Handler like,

exports.handler = skillBuilder
  .withSkillId("amzn1.ask.skill.1")
  .addRequestHandlers(
    HelloWorldIntentHandler,
    LaunchRequestHandler,
    HelpIntentHandler,
    CancelAndStopIntentHandler,
    SessionEndedRequestHandler,
  )
  .addErrorHandlers(ErrorHandler)
  .lambda();

You can add these like this way,

 const HelpIntentHandler = {
      canHandle(handlerInput) {
        return handlerInput.requestEnvelope.request.type === 'IntentRequest'
          && handlerInput.requestEnvelope.request.intent.name === 'AMAZON.HelpIntent';
      },
      handle(handlerInput) {
        const speechText = 'Your skill help content will be here';

        return handlerInput.responseBuilder
          .speak(speechText)
          .reprompt(speechText)
          .getResponse();
      },
    };

    const CancelAndStopIntentHandler = {
      canHandle(handlerInput) {
        return handlerInput.requestEnvelope.request.type === 'IntentRequest'
          && (handlerInput.requestEnvelope.request.intent.name === 'AMAZON.CancelIntent'
            || handlerInput.requestEnvelope.request.intent.name === 'AMAZON.StopIntent');
      },
      handle(handlerInput) {
        const speechText = 'Goodbye!';

        return handlerInput.responseBuilder
          .speak(speechText)
          .getResponse();
      },
    };


    const SessionEndedRequestHandler = {
      canHandle(handlerInput) {
        return handlerInput.requestEnvelope.request.type === 'SessionEndedRequest';
      },
      handle(handlerInput) {
        console.log(`Session ended with reason: ${handlerInput.requestEnvelope.request.reason}`);

        return handlerInput.responseBuilder.getResponse();
      },
    };

    const ErrorHandler = {
      canHandle() {
        return true;
      },
      handle(handlerInput, error) {
        console.log(`Error handled: ${error.message}`);

        return handlerInput.responseBuilder
          .speak('Sorry, I can\'t understand the command. Please say again.')
          .getResponse();
      },
    };

Also you can more details about voice interaction and User experience Testing and can verify your skill manually for the certification.