我在向Alexa Gateway发送事件AddOrUpdateReport
或事件时遇到问题。DeleteReport
虽然使用状态码ChangeReport
接受事件,但使用状态码、错误码和奇怪的描述来拒绝和。202
AddOrUpdateReport
DeleteReport
400
INVALID_REQUEST_EXCEPTION
scope not present in the raw event must not be null
我已经仔细检查了不记名令牌,这对于 ChangeReport 和其他事件是相同的。不记名令牌包含在所有事件的标头和有效负载的相关部分中。
测试中使用的令牌来自欧盟区域 lambda,然后将事件推送到欧盟端点https://api.eu.amazonalexa.com/v3/events
。
我真的不知道出了什么问题。
这是一个有效的ChangeReport
json 事件:
{
"event": {
"header": {
"namespace": "Alexa",
"name": "ChangeReport",
"messageId": "30490a44-b96e-11eb-8b34-005056910662",
"payloadVersion": "3"
},
"payload": {
"change": {
"cause": {
"type": "APP_INTERACTION"
},
"properties": [
{
"namespace": "Alexa.EndpointHealth",
"name": "connectivity",
"value": {
"value": "OK"
},
"timeOfSample": "2021-05-20T13:20:47Z",
"uncertaintyInMilliseconds": 4000
},
{
"namespace": "Alexa.PowerController",
"name": "powerState",
"value": "OFF",
"timeOfSample": "2021-05-20T13:20:47Z",
"uncertaintyInMilliseconds": 4000
}
]
}
},
"endpoint": {
"endpointId": "O-296880000011",
"scope": {
"type": "BearerToken",
"token": "Atza|IwEBIIxfjSbDo_I2RrLEA6tH-mk_F_krgPsNDNpXkQnYSFZXKX-cMxaIE5BAXGKemoa5SqVkfcUiielcOgrU8q8VFhIQyuvYXG91hgJsm4Pe7tpxYvQU6gqEyNiVaNkU0sHR_EGRtd9NApuv2iRebFqBOufo84Rglj8dSEsBDSFhev2gMForCygrewH92ryp39zscJss2qTGGVjQN1jdFWDD2VGI5POgQgLNFGQYjp1ke2-3azEp1u99P0BUIHkCG-FrhSnIjUB246zq66juuuRCZG8KdpLKZS8hnZ5BduffgHY_rQ"
}
}
}
}
DeleteReport
这是导致错误的事件:
{
"event": {
"header": {
"namespace": "Alexa.Discovery",
"name": "DeleteReport",
"messageId": "4380b756-b96e-11eb-8d44-005056910662",
"payloadVersion": "3"
},
"payload": {
"endpoints": [
{
"endpointId": "O-296880000011"
}
],
"scope": {
"type": "BearerToken",
"token": "Atza|IwEBIIxfjSbDo_I2RrLEA6tH-mk_F_krgPsNDNpXkQnYSFZXKX-cMxaIE5BAXGKemoa5SqVkfcUiielcOgrU8q8VFhIQyuvYXG91hgJsm4Pe7tpxYvQU6gqEyNiVaNkU0sHR_EGRtd9NApuv2iRebFqBOufo84Rglj8dSEsBDSFhev2gMForCygrewH92ryp39zscJss2qTGGVjQN1jdFWDD2VGI5POgQgLNFGQYjp1ke2-3azEp1u99P0BUIHkCG-FrhSnIjUB246zq66juuuRCZG8KdpLKZS8hnZ5BduffgHY_rQ"
}
}
}
}
这是网关的 400 错误回复:
{
"header":
{
"namespace": "System",
"name": "Exception",
"messageId": "f8aec837-9fd2-4031-ba6d-fa0f3e8cca29"
},
"payload":
{
"code": "INVALID_REQUEST_EXCEPTION",
"description": "scope not present in the raw event must not be null"
}
}