question

Kwami E Occansey avatar image
Kwami E Occansey asked

APL failing with error "'document' field must be not empty" yet i have provided the correct directive


I have created a document in the authoring tool and saved and provided the correct name in my response directive.

below is my response.json that is being sent from my lambda


{
    "version": "",
    "sessionAttributes": {
        "lastSpeech": "For the latest update on your account, just say 'tell me about my account'. Or <break time=\"250ms\"/>you can say another command from the list of things I can do. <break time=\"250ms\"/>What can I assist you with?",
        "lastIntent": "LaunchRequest",
        "FrictionTrun": false
    },
    "response": {
        "outputSpeech": {
            "type": "SSML",
            "ssml": "<speak>For the latest update on your account, just say 'tell me about my account'. Or <break time=\"250ms\"/>you can say another command from the list of things I can do. <break time=\"250ms\"/>What can I assist you with?</speak>",
            "image": {}
        },
        "card": {
            "type": "Standard",
            "title": "My Business",
            "text": "For the latest update on your account, just say 'tell me about my account'. Or you can say another command from the list of things I can do.  What can I assist you with?",
            "image": {
                "smallImageUrl": "https://url.jpg",
                "largeImageUrl": "https://url.jpg"
            }
        },
        "reprompt": {
            "outputSpeech": {
                "type": "SSML",
                "ssml": "<speak>For the latest update on your account, just say 'tell me about my account'. Or <break time=\"250ms\"/>you can say another command from the list of things I can do. <break time=\"250ms\"/>What can I assist you with?</speak>",
                "image": {}
            }
        },
        "directives": [
            {
                "token": "OpenMyBusinessAPLDocument",
                "document": {
                    "type": "Link",
                    "src": "doc://alexa/apl/documents/OpenMy"
                },
                "datasources": {
                    "gridListData": {
                        "type": "object",
                        "objectId": "gridListSample",
                        "backgroundImage": {
                            "contentDescription": null,
                            "smallSourceUrl": null,
                            "largeSourceUrl": null,
                            "sources": [
                                {
                                    "url": "https://d2o906d8ln7ui1.cloudfront.net/images/templates_v3/gridlist/GridListBackground_Dark.png",
                                    "size": "small",
                                    "widthPixels": 0,
                                    "heightPixels": 0
                                },
                                {
                                    "url": "https://d2o906d8ln7ui1.cloudfront.net/images/templates_v3/gridlist/GridListBackground_Dark.png",
                                    "size": "large",
                                    "widthPixels": 0,
                                    "heightPixels": 0
                                }
                            ]
                        },
                        "title": "My Business",
                        "listItems": [
                            {
                                "title": "MyAccountTitle",
                                "providerText": "Account providerText",
                                "primaryText": "Account primary Text",
                                "secondaryText": "MyAccount secondary Text",
                                "imageSource": "https://d2o906d8ln7ui1.cloudfront.net/images/templates_v3/gridlist/GridList_Image1.png",
                                "primaryAction": [
                                    {
                                        "type": "SetValue",
                                        "componentId": "plantList",
                                        "property": "headerTitle",
                                        "value": "${payload.gridListData.listItems[0].title} is selected",
                                        "item": {
                                            "type": "",
                                            "id": "",
                                            "color": "",
                                            "text": ""
                                        }
                                    },
                                    {
                                        "type": "SendEvent",
                                        "arguments": [
                                            "ListItemSelected",
                                            "${ordinal}"
                                        ],
                                        "item": {
                                            "type": "",
                                            "id": "",
                                            "color": "",
                                            "text": ""
                                        }
                                    },
                                    {
                                        "type": "TouchWrapper",
                                        "id": "idForTheTouchWrapper",
                                        "spacing": "@spacingSmall",
                                        "alignSelf": "center",
                                        "onPress": [
                                            {
                                                "type": "SendEvent",
                                                "arguments": [
                                                    "textWasPressed",
                                                    "Send this data to the skill: ${payload.gridListData.listItems[0].primaryText} is selected"
                                                ],
                                                "components": [
                                                    "idForTheTextComponent"
                                                ]
                                            }
                                        ],
                                        "item": {
                                            "type": "Text",
                                            "id": "idForTheTextComponent",
                                            "color": "@colorAccent",
                                            "text": "Click to send a UserEvent to the skill."
                                        }
                                    }
                                ]
                            },
                            {
                                "primaryText": "Internet",
                                "imageSource": "https://d2o906d8ln7ui1.cloudfront.net/images/templates_v3/gridlist/GridList_Image2.png",
                                "primaryAction": [
                                    {
                                        "type": "SetValue",
                                        "componentId": "plantList",
                                        "property": "headerTitle",
                                        "value": "${payload.gridListData.listItems[1].primaryText} is selected",
                                        "item": {
                                            "type": "",
                                            "id": "",
                                            "color": "",
                                            "text": ""
                                        }
                                    },
                                    {
                                        "type": "TouchWrapper",
                                        "id": "idForTheTouchWrapper",
                                        "spacing": "@spacingSmall",
                                        "alignSelf": "center",
                                        "onPress": [
                                            {
                                                "type": "SendEvent",
                                                "arguments": [
                                                    "textWasPressed",
                                                    "Send this data to the skill: ${payload.gridListData.listItems[1].primaryText} is selected"
                                                ],
                                                "components": [
                                                    "idForTheTextComponent"
                                                ]
                                            }
                                        ],
                                        "item": {
                                            "type": "Text",
                                            "id": "idForTheTextComponent",
                                            "color": "@colorAccent",
                                            "text": "Click to send a UserEvent to the skill."
                                        }
                                    }
                                ]
                            },
                            {
                                "primaryText": "Phone",
                                "imageSource": "https://d2o906d8ln7ui1.cloudfront.net/images/templates_v3/gridlist/GridList_Image3.png",
                                "primaryAction": [
                                    {
                                        "type": "SetValue",
                                        "componentId": "plantList",
                                        "property": "headerTitle",
                                        "value": "${payload.gridListData.listItems[2].primaryText} is selected",
                                        "item": {
                                            "type": "",
                                            "id": "",
                                            "color": "",
                                            "text": ""
                                        }
                                    },
                                    {
                                        "type": "TouchWrapper",
                                        "id": "idForTheTouchWrapper",
                                        "spacing": "@spacingSmall",
                                        "alignSelf": "center",
                                        "onPress": [
                                            {
                                                "type": "SendEvent",
                                                "arguments": [
                                                    "textWasPressed",
                                                    "Send this data to the skill: ${payload.gridListData.listItems[2].primaryText} is selected"
                                                ],
                                                "components": [
                                                    "idForTheTextComponent"
                                                ]
                                            }
                                        ],
                                        "item": {
                                            "type": "Text",
                                            "id": "idForTheTextComponent",
                                            "color": "@colorAccent",
                                            "text": "Click to send a UserEvent to the skill."
                                        }
                                    }
                                ]
                            },
                            {
                                "primaryText": "Help",
                                "imageSource": "https://d2o906d8ln7ui1.cloudfront.net/images/templates_v3/gridlist/GridList_Image5.png",
                                "primaryAction": [
                                    {
                                        "type": "SetValue",
                                        "componentId": "plantList",
                                        "property": "headerTitle",
                                        "value": "${payload.gridListData.listItems[4].primaryText} is selected",
                                        "item": {
                                            "type": "",
                                            "id": "",
                                            "color": "",
                                            "text": ""
                                        }
                                    },
                                    {
                                        "type": "TouchWrapper",
                                        "id": "idForTheTouchWrapper",
                                        "spacing": "@spacingSmall",
                                        "alignSelf": "center",
                                        "onPress": [
                                            {
                                                "type": "SendEvent",
                                                "arguments": [
                                                    "textWasPressed",
                                                    "Send this data to the skill: ${payload.gridListData.listItems[4].primaryText} is selected"
                                                ],
                                                "components": [
                                                    "idForTheTextComponent"
                                                ]
                                            }
                                        ],
                                        "item": {
                                            "type": "Text",
                                            "id": "idForTheTextComponent",
                                            "color": "@colorAccent",
                                            "text": "Click to send a UserEvent to the skill."
                                        }
                                    }
                                ]
                            }
                        ],
                        "logoUrl": "https://d2o906d8ln7ui1.cloudfront.net/images/templates_v3/logo/logo-modern-botanical-white.png"
                    }
                },
                "type": "Alexa.Presentation.APL.RenderDocument",
                "timeoutType": "SHORT"
            }
        ],
        "shouldEndSession": false
    }
}
 
                

Here is the error from SessionEndedRequest

"request": {
"type": "SessionEndedRequest",
"requestId": "amzn1.echo-api.request.6d5c173d-a0a4-472b-a5ad-e71017b34fd1",
"timestamp": "2022-05-06T00:37:36Z",
"locale": "en-US",
"reason": "ERROR",
"error": {
"type": "INVALID_RESPONSE",
"message": "'document' field must be not empty"
}
}
}


Here is what is showing for directive in the JSON Output in the dev console

"directives": [
{
"type": "Alexa.Presentation.APL.RenderDocument",
"timeoutType": "SHORT"
}
]


I have even sent a directive with the full document and I'm getting the error.

{
                "type": "Alexa.Presentation.APL.RenderDocument",
                "token": "OpenComcastBusinessAPLDocument",
                "document": {
                    "type": "APL",
                    "version": "1.8",
                    "mainTemplate": {
                        "parameters": [
                            "payload"
                        ],
                        "items": [
                            {
                                "type": "AlexaGridList",
                                "id": "plantList",
                                "headerTitle": "${payload.gridListData.title}",
                                "headerBackButton": true,
                                "headerAttributionImage": "${payload.gridListData.logoUrl}",
                                "backgroundImageSource": "${payload.gridListData.backgroundImage.sources[0].url}",
                                "backgroundBlur": false,
                                "backgroundColorOverlay": false,
                                "imageAspectRatio": "standard_landscape",
                                "imageScale": "best-fill",
                                "imageShowProgressBar": false,
                                "listItems": "${payload.gridListData.listItems}"
                            }
                        ]
                    }
                },
                "datasources": {
  
alexaaplinteraction modelalexa skillsdialog directive
2 comments
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hi,

I can see you're using the Link option to specify where your document is held.

You're specifying doc://alexa/apl/documents/OpenMy

Is your APL document named "OpenMy" in the authoring tool ?

0 Likes 0 ·
yes the name matches
0 Likes 0 ·

1 Answer

Andy Whitworth avatar image
Andy Whitworth answered

From the output you've shown which appears in the dev console, it looks like you've got a bug where you construct the directive. Can you post the code section up where you populate the directive for your document inline test?

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.