gpt4 book ai didi

Alexa 技能 : Cannot convert undefined or null to object

转载 作者:行者123 更新时间:2023-12-04 10:48:06 29 4
gpt4 key购买 nike

设置完所有内容后,我在 Alexa 开发人员中测试技能时遇到此错误
请求技能的响应有问题,然后我将该 json 响应放入 lambda 测试中,得到以下结果

{ "errorType": "TypeError", "errorMessage": "Cannot convert undefined or null to object", "trace": [ "TypeError: Cannot convert undefined or null to object", " at Function.keys (<anonymous>)", " at Object.NewSession (/var/task/eventHandlers.js:28:20)", " at AlexaRequestEmitter.emit (events.js:198:13)", " at AlexaRequestEmitter.EventEmitter.emit (domain.js:448:20)", " at AlexaRequestEmitter.EmitEvent (/var/task/node_modules/alexa-sdk/lib/alexa.js:161:10)", " at AlexaRequestEmitter.HandleLambdaEvent (/var/task/node_modules/alexa-sdk/lib/alexa.js:124:23)", " at AlexaRequestEmitter.value (/var/task/node_modules/alexa-sdk/lib/alexa.js:74:31)", " at Runtime.exports.handler (/var/task/index.js:20:11)", " at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)" ] }

Log output



下面的部分显示了代码中的日志记录调用。这些对应于 CloudWatch 日志组中与此 Lambda 函数对应的单行。单击此处查看 CloudWatch 日志组。
START RequestId: f8127006-ae68-429b-b470-302b76bf3619 Version: $LATEST 2020-01-06T04:38:56.104Z f8127006-ae68-429b-b470-302b76bf3619 INFO Warning: Application ID is not set 2020-01-06T04:38:56.144Z f8127006-ae68-429b-b470-302b76bf3619 INFO {"eventType":"SessionStarted","event":{"userId":"amzn1.ask.account.AH5DAZ5QFPLU5NKA5XSU7PKCHUK4KCQTEUB3BBOSQ7COBQQ5EKW45X2445QZXZQJHO5HLXHIWSCPQ6TR2XYOZCPBG3GKDPQVWZK4WQN4OUWCNUW52WSLMZ2BBD4AANIR5SWIWQ5TJ6SSWN6KN5ZE73Q5UC6IBMONJ6MU6TRLLKFWUV3RKV7FE5P3SWODM23WJDXRVYBYDNZRRPY","sessionId":"amzn1.echo-api.session.92ab8d8e-8262-4f21-9f54-e556d78a8a6f","datestring":"2020-01-06T04:38:56.144Z"}} 2020-01-06T04:38:56.163Z f8127006-ae68-429b-b470-302b76bf3619 INFO Unexpected exception 'TypeError: Cannot convert undefined or null to object': TypeError: Cannot convert undefined or null to object at Function.keys (<anonymous>) at Object.NewSession (/var/task/eventHandlers.js:28:20) at AlexaRequestEmitter.emit (events.js:198:13) at AlexaRequestEmitter.EventEmitter.emit (domain.js:448:20) at AlexaRequestEmitter.EmitEvent (/var/task/node_modules/alexa-sdk/lib/alexa.js:161:10) at AlexaRequestEmitter.HandleLambdaEvent (/var/task/node_modules/alexa-sdk/lib/alexa.js:124:23) at AlexaRequestEmitter.value (/var/task/node_modules/alexa-sdk/lib/alexa.js:74:31) at Runtime.exports.handler (/var/task/index.js:20:11) at Runtime.handleOnce (/var/runtime/Runtime.js:66:25) 2020-01-06T04:38:56.163Z f8127006-ae68-429b-b470-302b76bf3619 ERROR Invoke Error {"errorType":"TypeError","errorMessage":"Cannot convert undefined or null to object","stack":["TypeError: Cannot convert undefined or null to object"," at Function.keys (<anonymous>)"," at Object.NewSession (/var/task/eventHandlers.js:28:20)"," at AlexaRequestEmitter.emit (events.js:198:13)"," at AlexaRequestEmitter.EventEmitter.emit (domain.js:448:20)"," at AlexaRequestEmitter.EmitEvent (/var/task/node_modules/alexa-sdk/lib/alexa.js:161:10)"," at AlexaRequestEmitter.HandleLambdaEvent (/var/task/node_modules/alexa-sdk/lib/alexa.js:124:23)"," at AlexaRequestEmitter.value (/var/task/node_modules/alexa-sdk/lib/alexa.js:74:31)"," at Runtime.exports.handler (/var/task/index.js:20:11)"," at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)"]} END RequestId: f8127006-ae68-429b-b470-302b76bf3619 REPORT RequestId: f8127006-ae68-429b-b470-302b76bf3619 Duration: 96.25 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 102 MB Init Duration: 567.43 ms

我试过添加未处理的函数,但什么也没发生我无法理解这个问题,请帮忙!!

最佳答案

调试此类编码错误的最简单方法是使用“本地调试”,以便您可以在 IDE 中单步调试代码。这比在 ASK 响应中使用普通堆栈跟踪或通过查看 CloudWatch 日志要方便得多。

请查看 https://developer.amazon.com/blogs/alexa/post/77c8f0b9-e9ee-48a9-813f-86cf7bf86747/setup-your-local-environment-for-debugging-an-alexa-skill

关于Alexa 技能 : Cannot convert undefined or null to object,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59607043/

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