Error during sending a signed http request to ElasticSearch

Đang mở
#188 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
aws, cpp, elasticsearch
Lĩnh vực
api, cloud, security

Hướng nghiên cứu

Bắt đầu với việc xây dựng request và lệnh gọi Aws::Client::AWSAuthV4Signer::SignRequest được nêu trong issue, sau đó tái hiện request tới Elasticsearch bằng region đã cấu hình và thông tin xác thực từ môi trường. So sánh các đầu vào dùng để ký với phản hồi của service; hoàn tất khi xác nhận được lỗi của library bằng một bản tái hiện tối thiểu hoặc ghi lại cách sửa cấu hình của bên gọi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

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<Aws::Auth::EnvironmentAWSCredentialsProvider>("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<Aws::StringStream> sstream = make_shared<Aws::StringStream>();
 *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;

 }`

Ngôn ngữ chính
C++
Star
465
Fork
98
Merge trung bình
1 giờ 16 phút
Pull request đã merge (30 ngày)
2

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của awslabs/aws-lambda-cpp

Tất cả issue của awslabs/aws-lambda-cpp

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.