Alexa Progressive Response causes error when using Jovo Debugger


#1

I have a skill that uses an Alexa Progressive Response while waiting to play an audio file. If I run the skill in the Jovo debugger I get the following error:

Error -----------------------------------------------------------------
  
  Code:
  ERROR
  
  Message:
  connect ECONNREFUSED 127.0.0.1:80
  
  Stack:
  Error: connect ECONNREFUSED 127.0.0.1:80
      at Function.progressiveResponse (/Users/bhartman/Development/jovo/FiveByFive/node_modules/jovo-platform-alexa/src/services/AlexaAPI.ts:73:13)
      at processTicksAndRejections (internal/process/task_queues.js:93:5)
  
   ----------------------------------------------------------------------
  
  
  Request details:
  this.$alexaSkill initialized
  this.$type: {"type":"INTENT"}
  this.$session.$data : {"personIdx":0}
  this.$nlu : {"intent":{"name":"YesIntent"}}
  this.$inputs : {}
  
  
   ----------------------------------------------------------------------
  
  unhandledRejection
  {}
  Error: Request failed with status code 500
      at createError (/Users/bhartman/Development/jovo/FiveByFive/node_modules/axios/lib/core/createError.js:16:15)
      at settle (/Users/bhartman/Development/jovo/FiveByFive/node_modules/axios/lib/core/settle.js:17:12)
      at IncomingMessage.handleStreamEnd (/Users/bhartman/Development/jovo/FiveByFive/node_modules/axios/lib/adapters/http.js:236:11)
      at IncomingMessage.emit (events.js:215:7)
      at IncomingMessage.EventEmitter.emit (domain.js:476:20)
      at endReadableNT (_stream_readable.js:1183:12)
      at processTicksAndRejections (internal/process/task_queues.js:80:21)

If I use the Alexa Developer test simulator, the progressive response works fine. However, I’d like to be able to use the Jovo debugger since I am using the audio player.


#2

Hi @Ben_Hartman, thanks for flagging!

That’s true. Since the Jovo Debugger is using sample JSON requests, the Alexa API endpoint for the progressive responses won’t work. We should definitely have a better way of handling this though. cc @AlexSwe


#3

The progressiveResponse API call needs the api access token which comes with every Alexa request. It’s a token that can’t be generated by the framework nor the webhook or debugger.

I think a helper like this.isJovoDebuggerRequest() would make it easier to bypass API calls that are not available with the JovoDebugger.

if (this.isJovoDebuggerRequest()) {
  this.ask(...);
} else {
  this.progressiveResponse(...)
}

What do you think?


#4

Hi @AlexSwe - yes, this would work for me, but I’m concerned about other users that potentially would hit the same problem and not know about this problem/solution. Is there any way (that’s reasonable) to handle the error down at the node_module level rather than put the responsibility on the user? If not, I can certainly implement your proposed solution and just wrap all my progressiveResponse calls in (if this.isAlexaSkill() && !this.isJovoDebuggerRequest()) checks. I’d also recommend saying something about it in the progressiveResponse section of the Jovo documentation. As developers, we love writing documentation, right? :wink:


#5

Good point. I updated the progressiveResponse method.
The API won’t be called in JovoDebugger requests and a warning will be shown.

It will be available with the next release.


#6

:+1: Thanks @AlexSwe


#7

Hello @AlexSwe,

I just updated to the latest versions of all the jovo packages and I confirmed that the progressive response is now handled gracefully when using the jovo debugger. However, now my Lambda function no longer works. Here’s the error that I see in CloudWatch:

{
    "errorType": "TypeError",
    "errorMessage": "Cannot read property 'jovo-debugger' of undefined",
    "stack": [
        "TypeError: Cannot read property 'jovo-debugger' of undefined",
        "    at AlexaSkill.isJovoDebuggerRequest (/var/task/node_modules/jovo-core/dist/src/core/Jovo.js:504:36)",
        "    at AlexaSkill.progressiveResponse (/var/task/node_modules/jovo-platform-alexa/dist/src/core/AlexaSkill.js:115:18)",
        "    at AlexaSkill.ChooseCategoryIntent (/var/task/handlers/getCategoryState.js:19:34)",
        "    at Function.applyHandle (/var/task/node_modules/jovo-core/dist/src/plugins/Handler.js:140:43)",
        "    at handle (/var/task/node_modules/jovo-core/dist/src/plugins/Handler.js:192:23)",
        "    at processTicksAndRejections (internal/process/task_queues.js:97:5)",
        "    at async Middleware.run (/var/task/node_modules/jovo-core/dist/src/core/Middleware.js:76:21)",
        "    at async App.handle (/var/task/node_modules/jovo-core/dist/src/core/BaseApp.js:203:13)",
        "    at async App.handle (/var/task/node_modules/jovo-framework/dist/src/App.js:265:9)",
        "    at async Runtime.exports.handler (/var/task/index.js:26:5)"
    ]
}

Was there an update to the API call for progressive response (i.e. am I missing something in the progressive response call) or is this a Jovo bug?

I am using the progressive response like this:

await this.$alexaSkill.progressiveResponse(`Please wait while I generate a random mix of words.`);

Thanks,
Ben


#8

Hey Ben

Oops. There was another bug related to the feature (Lambda compatibilty)

Fixed it, preparing the publish now


#9

Thanks @AlexSwe

I rebuilt this morning and now it works fine. I appreciate the quick response.

-Ben


#10

Great! Closing this now :slight_smile:


closed #11