Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/461.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Alexa NodeJS在speechoutput上失败,没有特定错误_Javascript_Jquery_Node.js_Aws Lambda_Alexa - Fatal编程技术网

Javascript Alexa NodeJS在speechoutput上失败,没有特定错误

Javascript Alexa NodeJS在speechoutput上失败,没有特定错误,javascript,jquery,node.js,aws-lambda,alexa,Javascript,Jquery,Node.js,Aws Lambda,Alexa,我正在尝试创建一个Alexa技能,它根据Alexa设备的位置在web服务上查找位置 我所有的代码都在工作,因为我可以在日志中看到正确的输出,但我正在努力让语音输出正常工作 任何帮助都将不胜感激。我对NodeJS很陌生。我觉得这与在https.request中调用tell有关,但我现在不知道如何解决这个问题 代码: 以及Lambda CloudWatch日志: START RequestId: *** Version: $LATEST Beginning execution for skill w

我正在尝试创建一个Alexa技能,它根据Alexa设备的位置在web服务上查找位置

我所有的代码都在工作,因为我可以在日志中看到正确的输出,但我正在努力让语音输出正常工作

任何帮助都将不胜感激。我对NodeJS很陌生。我觉得这与在https.request中调用tell有关,但我现在不知道如何解决这个问题

代码:

以及Lambda CloudWatch日志:

START RequestId: *** Version: $LATEST
Beginning execution for skill with APP_ID=amzn1.ask.skill.***
Starting newSessionRequestHandler()
Starting getAddressHandler()
Creating AlexaAddressClient instance.
Ending newSessionRequestHandler()
Ending execution for skill with APP_ID=amzn1.ask.skill.***
Device Address API responded with a status code of : 200
Address successfully retrieved, now responding to user.
test begin
Users postcode is *** ***
Post options set
Data returned!
returnData: {"location1":"123 Street Name, London, is currently open.","location2":"123 Street Name, London, is currently open.","store3":"123 Street Name, London, is currently open.","postcode":*** ***}
Nearest location: 123 Street Name, London, is currently open.
END RequestId: ***
REPORT RequestId: Duration: 1869.51 ms Billed Duration: 1900 ms Memory Size: 128 MB Max Memory Used: 31 MB
START RequestId:  Version: $LATEST
Beginning execution for skill with APP_ID=amzn1.ask.skill.***
Starting sessionEndedRequestHandler()
Ending sessionEndedRequestHandler()
Ending execution for skill with APP_ID=amzn1.ask.skill.***
END RequestId: 
REPORT RequestId:  Duration: 15.49 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 31 MB
我不是在寻找一个直接的解决方案,但是一个指向正确方向的指针会很好


感谢

在JavaScript中,this关键字的工作方式似乎有问题,您需要查看了解更多关于它的工作方式,以及它在箭头函数中的工作方式。

一个不完美的解决方案是在原始Alexa调用的范围内定义一个变量,然后在以后引用它。“设thiz=this;…thiz.emit…”
START RequestId: *** Version: $LATEST
Beginning execution for skill with APP_ID=amzn1.ask.skill.***
Starting newSessionRequestHandler()
Starting getAddressHandler()
Creating AlexaAddressClient instance.
Ending newSessionRequestHandler()
Ending execution for skill with APP_ID=amzn1.ask.skill.***
Device Address API responded with a status code of : 200
Address successfully retrieved, now responding to user.
test begin
Users postcode is *** ***
Post options set
Data returned!
returnData: {"location1":"123 Street Name, London, is currently open.","location2":"123 Street Name, London, is currently open.","store3":"123 Street Name, London, is currently open.","postcode":*** ***}
Nearest location: 123 Street Name, London, is currently open.
END RequestId: ***
REPORT RequestId: Duration: 1869.51 ms Billed Duration: 1900 ms Memory Size: 128 MB Max Memory Used: 31 MB
START RequestId:  Version: $LATEST
Beginning execution for skill with APP_ID=amzn1.ask.skill.***
Starting sessionEndedRequestHandler()
Ending sessionEndedRequestHandler()
Ending execution for skill with APP_ID=amzn1.ask.skill.***
END RequestId: 
REPORT RequestId:  Duration: 15.49 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 31 MB