duanluangua8850
2018-01-12 01:46
浏览 94
已采纳

转到AWS开发工具包“无法确定要授权的服务/操作名称”

I am using the Go SDK to connect to the Kinesis Video Streams service. When issuing a GetMedia request, I'm receiving a 403 response with the following body:

<AccessDeniedException>
  <Message>Unable to determine service/operation name to be authorized</Message>
</AccessDeniedException>

I am using LogLevel LogDebugWithHTTPBody to see this since the SDK is expecting JSON and receives XML, causing a SerializationError.

I am using Go 1.9.2 and have attempted this operation with both v1 and v2 of aws-sdk-go with the same result.

Here is my request:

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"}

Response:

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>

Any help would be greatly appreciated.

To follow up, I have tried to issue the HTTP request above directly with the Content-Type: application/json header added, and the response is now:

{
    "Output": {
        "__type": "com.amazon.coral.service#UnknownOperationException",
        "message": null
    },
    "Version": "1.0"
}
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doudou5421 2018-01-13 02:00
    已采纳

    I have found the solution. From the docs,

    "You must first call the GetDataEndpoint API to get an endpoint to which you can then send the GetMedia requests."

    打赏 评论

相关推荐 更多相似问题