It seems that instantiating the Cognitect AWS client for SQS works the first time, but subsequent instantiations and attempts to use the object (e.g., sending an SQS message) result in a ConnectionException (channel closes), which propagates as a CompletionException. This issue was resolved using defonce, but it appears to stem from a problem with interfaced endpoint services, where creating a new connection seems problematic. Has anyone else faced a similar issue?
Just a code example:
(let [sqs-client (aws/client {:api :sqs})]
(:QueueUrl
(aws/invoke sqs-client {:op :GetQueueUrl
:request {:QueueName "hey-you"}})))
=> ""
(let [sqs-client (aws/client {:api :sqs})]
(:QueueUrl
(aws/invoke sqs-client {:op :GetQueueUrl
:request {:QueueName "hey-you"}})))
Bum! CompletionException Just to describe the crime scene, it happened in a ElasticBeanstalk service, with both in same VPC and private subnets.
What version of aws-api are you using? I ask because the behavior of the default shared instance of the cognitect http client https://github.com/cognitect-labs/aws-api/blob/main/UPGRADE.md#08430. Also as of the latest release 0.8.711 there is a JDK-based, non-cognitect/Jetty http client that is the new default client.
com.cognitect.aws/sqs "869.2.1687.0"
com.cognitect.aws/api "0.8.711"
Java Corretto 21 running on 64bit Amazon Linux 2023/4.4.1