cognitect-labs / cognitect-labs/aws-api

Service Discovery DiscoverInstances operation doesn't work due to hostPrefix being defined

Open
#175 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Clojure
Stars
787
Forks
101
Avg merge
23h 11m
Merged PRs (30d)
2

Description

Dependencies

{:deps {com.cognitect.aws/api       {:mvn/version "0.8.505"}
        com.cognitect.aws/endpoints {:mvn/version "1.1.11.960"}
        com.cognitect.aws/servicediscovery       {:mvn/version "809.2.784.0"}}}

Description with failing test case

While using clj REPL I invoked the DiscoverInstances operation resulting in an UnknownOperationException.

(require '[cognitect.aws.client.api :as aws])
...
(aws/invoke sd {:op :DiscoverInstances
                :request {:NamespaceName "green.int.auto.sd"
                          :ServiceName "MyService"}})
=> {:__type "UnknownOperationException", :cognitect.anomalies/category :cognitect.anomalies/incorrect}

I noted that the service discovery operation is unique in that it has the following:

:endpoint {:hostPrefix "data-"}

as part of the operation definition:

:DiscoverInstances {:name "DiscoverInstances",
                                  :http {:method "POST",
                                         :requestUri "/"},
                                  :input {:shape "DiscoverInstancesRequest"},
                                  :output {:shape "DiscoverInstancesResponse"},
                                  :errors [{:shape "ServiceNotFound"}
                                           {:shape "NamespaceNotFound"}
                                           {:shape "InvalidInput"}
                                           {:shape "RequestLimitExceeded"}],
                                  :endpoint {:hostPrefix "data-"}}

When using a client that has the following added at creation time:

:endpoint-override {:hostname "data-servicediscovery.ap-southeast-2.amazonaws.com"}

so as to include the 'data-' prefix to the normal service discovery endpoint, executing the DiscoverInstances operation is successful.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the DiscoverInstances call with the dependency versions and request shown, then inspect how the operation's hostPrefix is handled when constructing the endpoint. Compare the failing default client with the endpoint-override case. Done means DiscoverInstances succeeds without manually adding the data- prefix, with coverage for this operation.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, clojure
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.