alexa-js / alexa-app

A framework for Alexa (Amazon Echo) apps using Node.js
https://www.youtube.com/watch?v=pzM4jv7k7Rg
MIT License
1.03k stars 213 forks source link

Unknown error occurs when using response.card #354

Closed favna closed 6 years ago

favna commented 6 years ago

For my skill I'd like to have both a spoken response as well as a card response so people can view the data again later in the app, however whenever I add my response.card Alexa throws There was a problem with the skill's response without any indication of what the error is. There is also no indication of what the error is on Lambda and the exact same input works just fine when only having a response.say.

AWS logs:

Code can be seen in my CardResponses branch (currently only the DexIntent file):

https://bitbucket.org/Favna/dexa/src/CardResponses/functions/dexa/intents/dexintent.js#lines-126

When logging the response in manual mocha tests it does seem to be a-ok when comparing it to what Amazon has in their docs (barring that their example doesn't have SSML but Plain Text for the outputSpeechType)

// with card
{
  version: '1.0',
  response: {
    directives: [],
    shouldEndSession: true,
    outputSpeech: {
      type: 'SSML',
      ssml: '<speak>Dragonite, number 149, You\'ll often hear tales of this kindhearted Pokémon rescuing people or Pokémon that are drowning. It is Dragon Flying type. It\'s pre-evolutions are Dragonair and Dratini. Dragonite gets the abilities Inner Focus and Multiscale and it is typically 2.2 meters tall and weighs about 210 kilograms. Dragonite appears as roughly 50% Male and 50% Female.</speak>'
    },
    card: {
      type: 'simple',
      title: 'Pokemon Data for Dragonite',
      content: 'test'
    }
  },
  sessionAttributes: {}
}
// without card
{
  version: '1.0',
  response: {
    directives: [],
    shouldEndSession: true,
    outputSpeech: {
      type: 'SSML',
      ssml: '<speak>Dragonite, number 149, You\'ll often hear tales of this kindhearted Pokémon rescuing people or Pokémon that are drowning. It is Dragon Flying type. It\'s pre-evolutions are Dragonair and Dratini. Dragonite gets the abilities Inner Focus and Multiscale and it is typically 2.2 meters tall and weighs about 210 kilograms. Dragonite appears as roughly 50% Male and 50% Female.</speak>'
    }
  },
  sessionAttributes: {}
}

Some Semantic stuff

kobim commented 6 years ago

Hi @Favna ,

Before digging any further, can you test a simple res.say in your CardResponses branch? The SkillDebugger log you attached showing there was no response from your lambda function, so I just want to verify whether this is a framework (bad card format) or a setup (restricted lambda) issue. Also, if you can mention your Lambda node.js version, it can help too.

favna commented 6 years ago

@kobim res.say works just fine, both in my CardResponses branch and master branch. My Lambda is on Node 6.10, I've trying to make that go to Node 8.11.2 but everytime I do an apex deploy it is set back 🤔

favna commented 6 years ago

I made a lot of adjustments to the code as Amazon got back to me for my skill verification and thus I have updated the URL of the code part of card stuff on the original post but just for good measure, here it is as well.

The card code is now commented out, but it is otherwise unchanged since the original post and the issue persists.

kobim commented 6 years ago

Try using type: 'Simple' (upper case first letter) and not lower-case simple. (it took me a while to notice that)

favna commented 6 years ago

Oh wow that did it. I didn't notice that at all either. Thanks!