Hi,
I have a simple APL layout which will be rendered if I say "hello". When rendering for the first time, it was okay. However, when I said "hello" for the second time, it crashed.
This is my APL
{ "type": "APL", "version": "1.4", "theme": "dark", "graphics": {}, "import": [ { "name": "alexa-layouts", "version": "1.2.0" } ], "mainTemplate": { "parameters": [ "payload" ], "items": [ { "type": "Container", "width": "100%", "height": "100%", "justifyContent": "center", "items": [ { "type": "AlexaButton", "buttonText": "Contained Style", "id": "containedButtonId", "paddingLeft": "@spacingLarge", "paddingRight": "@spacingLarge", "paddingBottom": "@spacingLarge", "paddingTop": "@spacingLarge", "primaryAction": { "type": "SendEvent", "componentId": "containedButtonId", "arguments": [ "contained" ] } }, { "type": "AlexaButton", "buttonText": "Outlined Style", "buttonStyle": "outlined", "id": "outlinedButtonId", "paddingLeft": "@spacingLarge", "paddingRight": "@spacingLarge", "paddingBottom": "@spacingLarge", "paddingTop": "@spacingLarge", "primaryAction": { "type": "SendEvent", "componentId": "outlinedButtonId", "arguments": [ "outlined" ] } } ] } ] } }
And this is the HelloIntent
const HelloWorldIntentHandler = { canHandle(handlerInput) { return Alexa.getRequestType(handlerInput.requestEnvelope) === 'IntentRequest' && Alexa.getIntentName(handlerInput.requestEnvelope) === 'HelloWorldIntent'; }, handle(handlerInput) { const speakOutput = 'Hello World!'; return handlerInput.responseBuilder .speak(speakOutput) .addDirective( { type: 'Alexa.Presentation.APL.RenderDocument', token: "helloworldWithButtonToken2", document: main2, datasources: {} }) .reprompt('add a reprompt if you want to keep the session open for the user to respond') .getResponse(); } };
Do I miss something if I want to use alexa-layouts?
Thanks.