Aws lambda AWS lambda中的Alexa自定义技能无法识别Alexa.getSupportedInterfaces[错误处理:Alexa.getSupportedInterfaces不是函数]

Aws lambda AWS lambda中的Alexa自定义技能无法识别Alexa.getSupportedInterfaces[错误处理:Alexa.getSupportedInterfaces不是函数],aws-lambda,alexa,alexa-presentation-language,Aws Lambda,Alexa,Alexa Presentation Language,尝试在AWS托管的自定义lambda函数中使用Alexa表示语言功能。意图处理程序正在启动,但当我添加 Alexa.GetSupportedInterface它正在失败。 消息为“已处理错误:Alexa.getSupportedInterfaces不是函数” 而不是使用以下条件: Alexa1.getSupportedInterfaces(handlerInput.requestEnvelope['Alexa.Presentation.APL] 您可以使用以下条件检查设备是否支持APL: if

尝试在AWS托管的自定义lambda函数中使用Alexa表示语言功能。意图处理程序正在启动,但当我添加 Alexa.GetSupportedInterface它正在失败。 消息为“已处理错误:Alexa.getSupportedInterfaces不是函数”


而不是使用以下条件:

Alexa1.getSupportedInterfaces(handlerInput.requestEnvelope['Alexa.Presentation.APL]
您可以使用以下条件检查设备是否支持APL:

if (supportsAPL(handlerInput))
确保在索引文件中包含以下函数定义:

function supportsAPL(handlerInput) { 
    const supportedInterfaces = handlerInput.requestEnvelope.context.System.device.supportedInterfaces;
    const aplInterface = supportedInterfaces['Alexa.Presentation.APL'];
    return aplInterface != null && aplInterface != undefined;
}

function supportsAPLT(handlerInput) {
    const supportedInterfaces = handlerInput.requestEnvelope.context.System.device.supportedInterfaces;
    const aplInterface = supportedInterfaces['Alexa.Presentation.APLT'];
    return aplInterface != null && aplInterface != undefined;
}
希望这对我有帮助

function supportsAPL(handlerInput) { 
    const supportedInterfaces = handlerInput.requestEnvelope.context.System.device.supportedInterfaces;
    const aplInterface = supportedInterfaces['Alexa.Presentation.APL'];
    return aplInterface != null && aplInterface != undefined;
}

function supportsAPLT(handlerInput) {
    const supportedInterfaces = handlerInput.requestEnvelope.context.System.device.supportedInterfaces;
    const aplInterface = supportedInterfaces['Alexa.Presentation.APLT'];
    return aplInterface != null && aplInterface != undefined;
}