awslabs / awslabs/aws-lambda-cpp
Error during sending a signed http request to ElasticSearch
- Ngôn ngữ chính
- C++
- Star
- 465
- Fork
- 98
- Merge trung bình
- 12 giờ 47 phút
- Pull request đã merge (30 ngày)
- 3
Mô tả
hey,
I am running into an error while making a httprequest to Elastic Search The error is
> The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method
Following is the code. Any pointers to bug in my code or library would be appreciated.
```
`invocation_response my_handler(invocation_request const& request)
{
ClientConfiguration config;
config.region = Aws::Environment::GetEnv("AWS_REGION");
config.caFile = "/etc/pki/tls/certs/ca-bundle.crt";
auto credentialsProvider = Aws::MakeShared("es");
auto client = CreateHttpClient(config);
auto httpRequest = CreateHttpRequest(URL, HttpMethod::HTTP_GET,
Aws::Utils::Stream::DefaultResponseStreamFactoryMethod);
httpRequest->SetContentType("application/json");
nlohmann::json query1 = {};
query1.emplace("size", 25);
std::shared_ptr sstream = make_shared();
*sstream << query1;
httpRequest->AddContentBody(sstream);
Aws::Client::AWSAuthV4Signer signer(credentialsProvider, "es", config.region);
auto req = httpRequest.get();
signer.SignRequest(*req);
auto outcome = client->MakeRequest(httpRequest);
if (outcome->GetResponseCode() == HttpResponseCode::OK) {
cout << "SUCCESS" << endl;
} else {
// print the response from the http request
cout << "ERROR" << endl;
cout << outcome->GetResponseBody().rdbuf() << endl;
cout << outcome->GetResponseCode() << endl;
}`
```
Hướng dẫn đóng góp
Hướng nghiên cứu
Start with the request construction and Aws::Client::AWSAuthV4Signer::SignRequest call shown in the issue, then reproduce the request against Elasticsearch using the configured region and environment credentials. Compare the signing inputs with the service response; done means confirming a library defect with a minimal reproduction or documenting a correction to the caller's setup.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- aws, cpp, elasticsearch
- Lĩnh vực
- api, cloud, security
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 25/100