我正在使用Go SDK连接到Kinesis Video Streams服务。在发出GetMedia
请求时,我收到了以下正文的403回复:
<AccessDeniedException>
<Message>Unable to determine service/operation name to be authorized</Message>
</AccessDeniedException>
我正在使用LogLevel LogDebugWithHTTPBody
来查看此内容,因为SDK需要JSON并接收XML,从而导致SerializationError
。
我正在使用Go 1.9.2并尝试使用aws-sdk-go的v1和v2进行此操作,结果相同。
这是我的要求:
POST /getMedia HTTP/1.1
Host: kinesisvideo.us-west-2.amazonaws.com
User-Agent: aws-sdk-go/2.0.0-preview.1 (go1.9.2; darwin; amd64)
Content-Length: 141
Authorization: AWS4-HMAC-SHA256 Credential=AKIAXXXXXXXXXXXXXX/20180112/us-west-2/kinesisvideo/aws4_request, SignedHeaders=content-length;host;x-amz-date, Signature=60c625357b67c64caed32f5a0924882f26ffc776211801e94e7ecae84e7213c2
X-Amz-Date: 20180112T012511Z
Accept-Encoding: gzip
{"StartSelector":{"StartSelectorType":"NOW"},"StreamARN":"arn:aws:kinesisvideo:us-west-2:XXXXXXXXXXXXX:stream/StreamTest/XXXXXXXXXXXXX"}
响应:
HTTP/1.1 403 Forbidden
Content-Length: 130
Date: Fri, 12 Jan 2018 01:25:11 GMT
X-Amzn-Requestid: 6f1701aa-f737-11e7-bcd5-c70a68e72add
<AccessDeniedException>
<Message>Unable to determine service/operation name to be authorized</Message>
</AccessDeniedException>
非常感谢任何帮助。
要跟进,我尝试直接发出上面的HTTP请求并添加了Content-Type: application/json
标头,现在响应是:
{
"Output": {
"__type": "com.amazon.coral.service#UnknownOperationException",
"message": null
},
"Version": "1.0"
}
答案 0 :(得分:0)
我找到了解决方案。来自文档,
&#34;您必须首先调用GetDataEndpoint API以获取可以向其发送GetMedia请求的端点。&#34;