alexa-skills-kit-sdk-for-nodejs icon indicating copy to clipboard operation
alexa-skills-kit-sdk-for-nodejs copied to clipboard

Improve request/response format on local debugging

Open Shreyas-vgr opened this issue 4 years ago • 2 comments

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Performance issue
[x] Feature request
[ ] Documentation issue or request
[ ] Other... Please describe:

Expected Behavior

Skill response 
{
 "type": "SkillResponseSuccessMessage",
 "originalRequestId": "wsds-transport-requestId.v1.AAAAAAAAAABuOe3dmSqjB0NANFiJtyyrrwAAAAAAAADmWydqD2+vq+M3lCEVv45tmjEo69AP3Zixbdyp/VnsjbhHCOI3QGv0Cc4SNwgPOa1MCghbT/8OWruCyszndP0zMftO19sCStf9erDdWe5WLXk4vLevoNoscdivH/DNtXgeJyBJWFPvtRa4OhuWXSSn2s8phzo2H/Ewv9akiDvdj6jQzwm8yLFVgiruPJVDvIYI2kzH63q7us1/RZ6FVbbEwYb7IJasi7zuraee0hvu",
 "version": "1.0",
 "responsePayload": {
   "version": "1.0",
   "response": {
     "directives": [
       {
         "type": "Alexa.Presentation.APL.RenderDocument",
         "token": "token",
         "document": {
           "type": "APL",
           "version": "1.5",
           ....<shortened for issue>
         },
         "datasources": {}
       }
     ],
     "outputSpeech": {
       "type": "SSML",
       "ssml": "<speak>How old will you be?</speak>"
     },
     "reprompt": {
       "outputSpeech": {
         "type": "SSML",
         "ssml": "<speak>What number?</speak>"
       }
     },
     "shouldEndSession": false
   },
   "userAgent": "ask-node/2.10.1 Node/v12.20.1 nCtrl:4",
   "sessionAttributes": {
     "__controlState": "{\n  \"root\": {\n    \"lastInitiativeChild\": {\n      \"controlId\": \"age\",\n      \"turnNumber\": 1\n    }\n  },\n  \"age\": {\n    \"isValueConfirmed\": false,\n    \"rejectedValues\": [],\n    \"isValidValue\": false,\n    \"lastInitiative\": {}\n  },\n  \"guests\": {\n    \"isValueConfirmed\": false,\n    \"rejectedValues\": [],\n    \"isValidValue\": false,\n    \"lastInitiative\": {}\n  },\n  \"partyThemeControl\": {\n    \"value\": [],\n    \"lastInitiative\": {}\n  }\n}",
     "__controlContext": "{\n  \"turnNumber\": 1\n}"
   }
 }
}

Current Behavior

Skill response 
 {
  "type": "SkillResponseSuccessMessage",
  "originalRequestId": "wsds-transport-requestId.v1.AAAAAAAAAABuOe3dmSqjB0NANFiJtyyrrwAAAAAAAABqS+nshImXfgurrAB25vqvfq5Pd3L4DFz1UnIa4/uWdKhiZqu/pmJ0r0WMk52mxtSTL9VTGJqd+zIfUzxI1xpu7FjAedn85etW05aYvaWV9q0J7K8rn3F8FqLBoKxlR2VUxChSZCz2aTklwl+m4Dqa4yGMmVsAAmGQmwQcGar+7DbeRf6RF+7ozu3vKIKzFHCuhB2Vx0p9pQ2pDmSymK8r7uhALvFXFDU6hRy8NCp6",
  "version": "1.0",
  "responsePayload": "{\"version\":\"1.0\",\"response\":{\"directives\":[{\"type\":\"Alexa.Presentation.APL.RenderDocument\",\"token\":\"token\",\"document\":{\"type\":\"APL\",\"version\":\"1.5\",\"import\":[{\"name\":\"alexa-layouts\",\"version\":\"1.2.0\"}],\"styles\":{\"ComponentPlaceholderStyle\":{\"values\":[{\"borderColor\":\"white\",\"borderWidth\":\"2px\",\"padding\":\"0\"}]},\"EditStyle\":{\"values\":[{\"borderWidth\":2,\"borderStrokeWidth\":1,\"borderColor\":\"darkgrey\",\"hintColor\":\"grey\",\"fontSize\":\"40dp\"},{\"when\":\"${state.focused}\",\"borderStrokeWidth\":2}]},\"NumberControlFrameStyle\":{\"values\":[{\"borderWidth\":2,\"borderStrokeWidth\":1,\"borderColor\":\"darkgrey\",\"hintColor\":\"grey\",\"fontSize\":\"40dp\"},{\"when\":\"${state.focused}\",\"borderStrokeWidth\":2}]},\"LabelStyle\":{\"values\":[{\"fontSize\":\"24dp\"}]}},\"layouts\":{\"MultiValueListSelector\":{\"parameters\":[{\"name\":\"controlId\",\"type\":\"string\"},{\"name\":\"payload\",\"type\":\"object\"}],\"items\":[{\"type\":\"Container\",\"direction\":\"row\",\"width\":\"100%\",\"height\":\"100%\",\"items\":[{\"type\":\"Container\",\"width\":\"50%\",\"items\":[{\"type\":\"Sequence\",\"data\":\"${payload.choices.listItems}\",\"numbered\":true,\"grow\":1,\"paddingLeft\":\"10px\",\"items\":[{\"type\":\"AlexaTextListItem\",\"hideHorizontalMargin\":true,\"primaryText\":\"${data.primaryText}\",\"primaryAction\":{\"type\":\"Sequential\",\"commands\":[{\"type\":\"SetValue\",\"componentId\":\"root\",\"property\":\"debugText\",\"value\":\"${ordinal}\"},{\"type\":\"SendEvent\",\"arguments\":[\"${payload.general.controlId}\",\"Select\",\"${ordinal}\"]}]},\"touchForward\":true}]}]},{\"type\":\"Container\",\"width\":\"50%\",\"items\":[{\"type\":\"AlexaBackground\",\"backgroundColor\":\"white\"},{\"type\":\"Text\",\"style\":\"textStyleMetadata\",\"color\":\"black\",\"textAlign\":\"center\",\"textAlignVertical\":\"center\",\"maxLines\":1,\"paddingTop\":\"@spacingXSmall\",\"text\":\"${payload.general.selectionListTitle}\"},{\"type\":\"Text\",\"style\":\"textStyleMetadataAlt\",\"color\":\"black\",\"textAlign\":\"center\",\"textAlignVertical\":\"center\",\"maxLines\":1,\"text\":\"${payload.general.selectionListSubtitle}\"},{\"type\":\"Sequence\",\"scrollDirection\":\"vertical\",\"data\":\"${payload.selections.listItems}\",\"numbered\":true,\"grow\":1,\"items\":[{\"type\":\"Container\",\"items\":[{\"type\":\"AlexaSwipeToAction\",\"touchForward\":true,\"hideOrdinal\":true,\"theme\":\"light\",\"actionIconType\":\"AVG\",\"actionIcon\":\"cancel\",\"actionIconBackground\":\"red\",\"primaryText\":\"${data.primaryText}\",\"onSwipeDone\":{\"type\":\"Sequential\",\"commands\":[{\"type\":\"SetValue\",\"componentId\":\"root\",\"property\":\"debugText\",\"value\":\"${ordinal}\"},{\"type\":\"SendEvent\",\"arguments\":[\"${payload.general.controlId}\",\"Remove\",\"${ordinal}\"]}]}}]}]}]}]}]}},\"mainTemplate\":{\"parameters\":[\"wrapper\"],\"item\":{\"id\":\"root\",\"type\":\"Container\",\"width\":\"100vw\",\"height\":\"100vh\",\"bind\":[{\"name\":\"disableContent\",\"value\":false,\"type\":\"boolean\"},{\"name\":\"enableWaitIndicator\",\"value\":false,\"type\":\"boolean\"}],\"items\":[{\"id\":\"label1\",\"type\":\"Text\",\"style\":\"LabelStyle\",\"position\":\"absolute\",\"top\":\"150px\",\"left\":\"50px\",\"width\":\"200px\",\"height\":\"100px\",\"text\":\"Your age:\"},{\"id\":\"ageComponent\",\"type\":\"Frame\",\"position\":\"absolute\",\"style\":\"ComponentPlaceholderStyle\",\"top\":\"200px\",\"left\":\"50px\",\"width\":\"200px\",\"height\":\"100px\",\"items\":[{\"id\":\"age\",\"type\":\"Container\",\"style\":\"NumberControlFrameStyle\",\"width\":\"100%\",\"height\":\"100%\",\"items\":[{\"type\":\"Container\",\"width\":\"100%\",\"height\":\"100%\",\"direction\":\"column\",\"items\":[{\"type\":\"EditText\",\"id\":\"editTextNumber\",\"style\":\"EditStyle\",\"keyboardType\":\"numberPad\",\"submitKeyType\":\"go\",\"onSubmit\":[{\"type\":\"Sequential\",\"commands\":[{\"type\":\"SendEvent\",\"arguments\":[\"age\",\"${event.source.value}\"]}]}],\"accessibilityLabel\":\"Enter a number\",\"minWidth\":\"100%\",\"maxWidth\":\"100%\",\"grow\":1,\"validCharacters\":\"-0-9\",\"hint\":\"[number]\",\"hintWeight\":\"normal\",\"fontSize\":\"34px\"},{\"type\":\"Text\",\"text\":\"Sorry but '' is not a valid choice.\",\"minWidth\":\"100%\",\"maxWidth\":\"100%\",\"height\":\"30px\",\"fontSize\":\"24px\",\"color\":\"red\"}]}]}]},{\"id\":\"label2\",\"type\":\"Text\",\"style\":\"LabelStyle\",\"position\":\"absolute\",\"top\":\"350px\",\"left\":\"50px\",\"width\":\"200px\",\"height\":\"100px\",\"text\":\"Number of guests:\"},{\"id\":\"guestsComponent\",\"type\":\"Frame\",\"position\":\"absolute\",\"style\":\"ComponentPlaceholderStyle\",\"top\":\"400px\",\"left\":\"50px\",\"width\":\"200px\",\"height\":\"100px\",\"items\":[{\"id\":\"guests\",\"type\":\"Container\",\"style\":\"NumberControlFrameStyle\",\"width\":\"100%\",\"height\":\"100%\",\"items\":[{\"type\":\"Container\",\"width\":\"100%\",\"height\":\"100%\",\"direction\":\"column\",\"items\":[{\"type\":\"EditText\",\"id\":\"editTextNumber\",\"style\":\"EditStyle\",\"keyboardType\":\"numberPad\",\"submitKeyType\":\"go\",\"onSubmit\":[{\"type\":\"Sequential\",\"commands\":[{\"type\":\"SendEvent\",\"arguments\":[\"guests\",\"${event.source.value}\"]}]}],\"accessibilityLabel\":\"Enter a number\",\"minWidth\":\"100%\",\"maxWidth\":\"100%\",\"grow\":1,\"validCharacters\":\"-0-9\",\"hint\":\"[number]\",\"hintWeight\":\"normal\",\"fontSize\":\"34px\"},{\"type\":\"Text\",\"text\":\"Maximum: 10\",\"minWidth\":\"100%\",\"maxWidth\":\"100%\",\"height\":\"30px\",\"fontSize\":\"24px\",\"color\":\"red\"}]}]}]},{\"id\":\"label3\",\"type\":\"Text\",\"style\":\"LabelStyle\",\"position\":\"absolute\",\"top\":\"150px\",\"left\":\"300px\",\"width\":\"200px\",\"height\":\"100px\",\"text\":\"Theme:\"},{\"id\":\"birthdayThemeComponent\",\"type\":\"Frame\",\"position\":\"absolute\",\"style\":\"ComponentPlaceholderStyle\",\"top\":\"200px\",\"left\":\"300px\",\"width\":\"700px\",\"height\":\"360px\",\"items\":[{\"type\":\"MultiValueListSelector\",\"controlId\":\"partyThemeControl\",\"payload\":{\"general\":{\"headerTitle\":\"Create your list\",\"headerSubtitle\":\"Say an item or touch it to add it your list\",\"selectionListTitle\":\"YOUR SELECTIONS\",\"selectionListSubtitle\":\"Swipe left to remove items\",\"controlId\":\"partyThemeControl\"},\"choices\":{\"listItems\":[{\"primaryText\":\"pirate\"},{\"primaryText\":\"cartoon\"},{\"primaryText\":\"fairy\"},{\"primaryText\":\"monster\"}]},\"selections\":{\"listItems\":[]}}}]},{\"type\":\"AlexaHeader\",\"style\":\"ComponentPlaceholderStyle\",\"backgroundColor\":\"#557755\",\"id\":\"heading1\",\"headerDivider\":true,\"headerBackButton\":\"${wrapper.general.headerBackButton}\",\"headerBackButtonCommand\":{\"type\":\"SendEvent\",\"arguments\":[\"goBack\"]},\"headerTitle\":\"Chucky Cheese\",\"headerSubtitle\":\"Birthday booking\"},{\"type\":\"AlexaButton\",\"id\":\"nextButton\",\"disabled\":\"${disableContent}\",\"buttonText\":\"${wrapper.general.nextButtonText}\",\"position\":\"absolute\",\"top\":\"10\",\"right\":\"10\",\"primaryAction\":{\"type\":\"Sequential\",\"commands\":[{\"type\":\"SetValue\",\"componentId\":\"debugText\",\"property\":\"text\",\"value\":\"Complete\"},{\"type\":\"SetValue\",\"componentId\":\"root\",\"property\":\"disableContent\",\"value\":true},{\"type\":\"SendEvent\",\"arguments\":[\"${wrapper.general.controlId}\",\"complete\"]}]}}]}}},\"datasources\":{}}],\"outputSpeech\":{\"type\":\"SSML\",\"ssml\":\"<speak>Welcome. How old will you be?</speak>\"},\"reprompt\":{\"outputSpeech\":{\"type\":\"SSML\",\"ssml\":\"<speak>What number?</speak>\"}},\"shouldEndSession\":false},\"userAgent\":\"ask-node/2.10.1 Node/v12.20.1 nCtrl:4\",\"sessionAttributes\":{\"__controlState\":\"{\\n  \\\"root\\\": {\\n    \\\"lastInitiativeChild\\\": {\\n      \\\"controlId\\\": \\\"age\\\",\\n      \\\"turnNumber\\\": 1\\n    }\\n  },\\n  \\\"age\\\": {\\n    \\\"isValueConfirmed\\\": false,\\n    \\\"rejectedValues\\\": [],\\n    \\\"isValidValue\\\": false,\\n    \\\"lastInitiative\\\": {}\\n  },\\n  \\\"guests\\\": {\\n    \\\"isValueConfirmed\\\": false,\\n    \\\"rejectedValues\\\": [],\\n    \\\"isValidValue\\\": false,\\n    \\\"lastInitiative\\\": {}\\n  },\\n  \\\"partyThemeControl\\\": {\\n    \\\"value\\\": [],\\n    \\\"lastInitiative\\\": {}\\n  }\\n}\",\"__controlContext\":\"{\\n  \\\"turnNumber\\\": 1\\n}\"}}"
}

Possible Solution

  • Either use better formatting of Skill response and Skill request
  • Or maybe just print out the response payload in JSON format so that it's easier to read and copy/paste for further debugging.

Steps to Reproduce (for bugs)

  • Setup ask-sdk-local-debug package and invoked the local debugger as mentioned in the docs.

Your Environment

  • ASK SDK for Node.js used: 2.10.1
  • Operating System and version: MacOS

Node.js and NPM Info

  • Node.js version used for development: v12.20.1
  • NPM version used for development: v7.5.4

Shreyas-vgr avatar Feb 18 '21 20:02 Shreyas-vgr

Good request! I was going to suggest this but I thought I was being stupid and just hadn't seen a config somewhere.

Give that the json input and response are shown in the simulator window, what would be much more useful in the debug window would be my own console.warn/log/error output. OR another window in the simulator for logging info? image

talkingnews avatar Feb 19 '21 08:02 talkingnews

Is this issue/feature-request still relevant? We are working on prioritization of relevant issues and cleanup of rest. If we don’t hear back in 2 weeks, we will assume that the issue is not relevant and we will close it.

rahulawl avatar Sep 12 '22 10:09 rahulawl