Error during sending a signed http request to ElasticSearch

オープン
#188 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
aws, cpp, elasticsearch
領域
api, cloud, security

調査の方向性

Issueに示されているリクエストの構築と Aws::Client::AWSAuthV4Signer::SignRequest の呼び出しから始め、設定されたリージョンと環境認証情報を使用して Elasticsearch に対するリクエストを再現します。署名の入力値とサービスのレスポンスを比較します。ライブラリの不具合を最小限の再現で確認するか、呼び出し側の設定の修正を文書化できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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;

 }`

主要言語
C++
スター
465
フォーク
98
平均マージ
1時間 16分
マージ済み PR(30日)
2

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

awslabs/aws-lambda-cpp のほかの issue

awslabs/aws-lambda-cpp の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。