ask_sdk_runtime.exceptions.DispatchException:无法找到合适的请求处理程序

问题描述

我正在使用Alexa开发我的第一项技能,并且正在使用插槽,但是在插槽响应方面我有一个小问题。并且出现错误ask_sdk_runtime.exceptions.dispatchException:无法找到合适的请求处理程序,我该如何解决

this is the error

解决方法

我建议添加一个 RequestInterceptor 来记录所有传入的请求。通过这种方式,您可以找出导致问题的请求类型。

示例代码:

class LogRequestInterceptor(AbstractRequestInterceptor):
    def process(self,handler_input):
        logger.info(f"Request type: {handler_input.request_envelope.request.object_type}")

然后像其他处理程序一样将其添加到您的技能构建器中: sb.add_global_request_interceptor(LogRequestInterceptor())

Python AbstractRequestInterceptor 文档:https://alexa-skills-kit-python-sdk.readthedocs.io/en/latest/api/core.html?highlight=requestinterceptor#ask_sdk_core.dispatch_components.request_components.AbstractRequestInterceptor

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...