I'm trying to use APL in a skill I'm creating. I'm using the Python ASK SDK to develop it (FWIW, the code can be found here). If a device supports the Alexa.Presentation.APL interface, I add an RenderDocumentDirective to the response and send it off to the device. This, however, results in an immediate new invocation of type SessionEndedRequest with INTERNAL_SERVICE_ERROR as the error reason. I've tested the APL document in the Display simulator and it all worked fine so I'm not sure what's going on.
Here's the JSON I send from my skill:
{ "version": "1.0", "sessionAttributes": { "launch_count": 12, "previous_session_end": 1545238739, "session_data": { "operation": "add", "difficulty": 1, "correct_result": 14, "questions_count": 0, "correct_answers_count": 0, "streak_count": 0 } }, "userAgent": "ask-python/1.5.0 Python/3.6.1 alexa-math-practice-skill/1.0.0", "response": { "outputSpeech": { "type": "SSML", "ssml": "<speak>OK. Let's get started. What is 6 plus 8?</speak>" }, "reprompt": { "outputSpeech": { "type": "SSML", "ssml": "<speak>What is 6 plus 8?</speak>" } }, "directives": [ { "type": "Alexa.Presentation.APL.RenderDocument", "document": { "type": "APL", "version": "1.0", "import": [ { "name": "alexa-styles", "version": "1.0.0" } ], "mainTemplate": { "parameters": [ "payload" ], "items": [ { "type": "Container", "alignItems": "center", "justifyContent": "center", "height": "100vh", "width": "100vw", "items": [ { "type": "Text", "fontSize": "@fontSizeXXLarge", "fontWeight": "@fontWeightLight", "text": "${payload.op1} ${payload.operator} ${payload.op2}" } ] } ] } }, "datasources": { "op1": 6, "op2": 8, "operand": "+" } } ], "shouldEndSession": false }
And here's the INTERNAL_SERVICE_ERROR invocation that follows:
{ "version": "1.0", "session": { "new": false, "sessionId": "amzn1.echo-api.session.ea9d15a6-93fe-4721-8f3c-5a2f6c3cdf8a", "application": { "applicationId": "amzn1.ask.skill.d455ad8c-dde9-4ee8-a492-4e3985b5ff79" }, "attributes": { "launch_count": 12, "session_data": { "operation": "add", "difficulty": 1, "correct_result": 14, "questions_count": 0, "correct_answers_count": 0, "streak_count": 0 }, "previous_session_end": 1545238739 }, "user": { "userId": "foo" } }, "context": { "System": { "application": { "applicationId": "amzn1.ask.skill.d455ad8c-dde9-4ee8-a492-4e3985b5ff79" }, "user": { "userId": "foo" }, "device": { "deviceId": "foo", "supportedInterfaces": { "Alexa.Presentation.APL": { "runtime": { "maxVersion": "1.0" } } } }, "apiEndpoint": "https://api.amazonalexa.com", "apiAccessToken": "foo" }, "Viewport": { "experiences": [ { "arcMinuteWidth": 346, "arcMinuteHeight": 216, "canRotate": false, "canResize": false } ], "shape": "RECTANGLE", "pixelWidth": 1280, "pixelHeight": 800, "dpi": 160, "currentPixelWidth": 1280, "currentPixelHeight": 800, "touch": [ "SINGLE" ], "keyboard": [] } }, "request": { "type": "SessionEndedRequest", "requestId": "amzn1.echo-api.request.c63717a4-b8de-4642-9758-fc7b3b145e35", "timestamp": "2018-12-20T13:22:50Z", "locale": "en-US", "reason": "ERROR", "error": { "type": "INTERNAL_SERVICE_ERROR", "message": "Internal Server Error" } }
What am I doing wrong? Thank you for any pointers.