gpt4 book ai didi

Alexa技能套件-Lambda函数-无法验证SpeechletRequest(java)

转载 作者:行者123 更新时间:2023-12-04 05:11:53 25 4
gpt4 key购买 nike

我试图基于https://github.com/amzn/alexa-skills-kit-java创建一个HelloWorld技能,但是当我测试了lambda函数时,它显示了此错误

{
"errorMessage":"com.amazon.speech.speechlet.SpeechletRequestHandlerException: Could not validate SpeechletRequest null using verifier ApplicationIdSpeechletRequestVerifier, rejecting request",

"errorType": "java.lang.RuntimeException",

"stackTrace": [ "com.amazon.speech.speechlet.lambda.SpeechletRequestStreamHandler.handleRequest(SpeechletRequestStreamHandler.java:101)",
"helloworld.HelloWorldSpeechletRequestStreamHandler.handleRequest(HelloWorldSpeechletRequestStreamHandler.java:43)"

],

"cause": {

"errorMessage": "Could not validate SpeechletRequest null using
verifier ApplicationIdSpeechletRequestVerifier, rejecting request",
"errorType": "com.amazon.speech.speechlet.SpeechletRequestHandlerException",

"stackTrace": [
"com.amazon.speech.speechlet.SpeechletRequestHandler.handleSpeechletCall(SpeechletRequestHandler.java:73)",
"com.amazon.speech.speechlet.lambda.SpeechletRequestStreamHandler.handleRequest(SpeechletRequestStreamHandler.java:98)",
"helloworld.HelloWorldSpeechletRequestStreamHandler.handleRequest(HelloWorldSpeechletRequestStreamHandler.java:43)"
]
}
}

这是我的Java文件
public final class HelloWorldSpeechletRequestStreamHandler extends SpeechletRequestStreamHandler {
private static final Set<String> supportedApplicationIds = new HashSet<String>();
static {
/*
* This Id can be found on https://developer.amazon.com/edw/home.html#/ "Edit" the relevant
* Alexa Skill and put the relevant Application Ids in this Set.
*/
supportedApplicationIds.add("amzn1.echo-sdk-ams.app.[amzn1.echo-sdk-ams.app.56bcdaf9-97fc-47f9-9918-43cb6a90d9f5]");
}


public HelloWorldSpeechletRequestStreamHandler() {
super(new HelloWorldSpeechlet(), supportedApplicationIds);
}
}

我想念什么?

最佳答案

对我来说,我遇到了这个异常,因为我尝试在“操作”选项卡下没有正确的测试事件JSON的情况下运行我的lambda函数。如果单击“操作”选项卡,然后单击“配置测试事件”,则应该以JSON形式提供您可以解释的函数输入。经过仔细研究,我发现可以通过开发具有所有技能配置的技能的开发人员控制台来获取此JSON。在左侧单击“测试”选项卡,然后转到显示“服务模拟器”的部分。有一个显示“Enter Utterance”的文本框,您可以在其中以文本形式输入语音命令至函数,例如“Alexa告诉[yourApp]说声“你好”。单击“询问[yourApp]”按钮,将在左侧框中生成Lambda请求JSON,并在右侧显示输出。然后,只需将左侧的JSON复制并粘贴到lambda控制台中的测试事件中,就可以了。

关于Alexa技能套件-Lambda函数-无法验证SpeechletRequest(java),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37742554/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com