question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error instantiating SqsClient - Unable to load an HTTP implementation from any provider in the chain. You must declare a dependency on an appropriate HTTP implementation or pass in an SdkHttpClient explicitly to the client builder.

See original GitHub issue

Hi,

I am trying to instantiate SqsClient in my Scala project. When I build the image and deploy it in the EKS cluster, I keep getting the following error:

software.amazon.awssdk.core.exception.SdkClientException: Unable to load an HTTP implementation from any provider in the chain. You must declare a dependency on an appropriate HTTP implementation or pass in an SdkHttpClient explicitly to the client builder.

I am testing my code in EKS cluster where Pods are configured with ServiceAccount. I verified the two AWS_ROLE_ARN and AWS_WEB_IDENTITY_TOKEN_FILE environment variables are populated with valid values. Expecting the authentication to take place using the web identity token. I tried various version of AWS SDK from 2.10.11 onwards. Currently using the 2.13.9.

I am trying to instantiate SqsClient as shown below:

         SqsClient.builder()
               .region(Region.US_EAST_1)
               .httpClient(ApacheHttpClient.builder().build())
              .build()

Going by some suggestions in the other forums, I tried to instantiate WebIdentityTokenFileCredentialsProvider explicitly:

         SqsClient.builder()
                      .region(Region.US_EAST_1)
                      .credentialsProvider(WebIdentityTokenFileCredentialsProvider.create())
                      .build()

Out sbt config:

libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.2.3"
libraryDependencies += "com.typesafe.scala-logging" %% "scala-logging" % "3.9.2"
libraryDependencies += "com.typesafe" % "config" % "1.3.3"
libraryDependencies += "software.amazon.awssdk" % "sqs" % "2.13.9"
//libraryDependencies += "software.amazon.awssdk" % "sts" % "2.13.9"

I have also tried to use the following in sbt which includes a libraries for various services:

libraryDependencies += "software.amazon.awssdk" % "aws-sdk-java" % "2.13.9"

Following is the exception stacktrace:

software.amazon.awssdk.core.exception.SdkClientException: Unable to load an HTTP implementation from any provider in the chain. You must declare a dependency on an appropriate HTTP implementation or pass in an SdkHttpClient explicitly to the client builder.
	at software.amazon.awssdk.core.exception.SdkClientException$BuilderImpl.build(SdkClientException.java:98)
	at software.amazon.awssdk.core.internal.http.loader.DefaultSdkHttpClientBuilder.lambda$buildWithDefaults$1(DefaultSdkHttpClientBuilder.java:49)
	at java.util.Optional.orElseThrow(Optional.java:290)
	at software.amazon.awssdk.core.internal.http.loader.DefaultSdkHttpClientBuilder.buildWithDefaults(DefaultSdkHttpClientBuilder.java:43)
	at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.lambda$resolveSyncHttpClient$5(SdkDefaultClientBuilder.java:269)
	at java.util.Optional.orElseGet(Optional.java:267)
	at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.resolveSyncHttpClient(SdkDefaultClientBuilder.java:269)
	at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.finalizeSyncConfiguration(SdkDefaultClientBuilder.java:220)
	at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.syncClientConfiguration(SdkDefaultClientBuilder.java:153)
	at software.amazon.awssdk.services.sqs.DefaultSqsClientBuilder.buildClient(DefaultSqsClientBuilder.java:27)
	at software.amazon.awssdk.services.sqs.DefaultSqsClientBuilder.buildClient(DefaultSqsClientBuilder.java:22)
	at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.build(SdkDefaultClientBuilder.java:124)

Environment

  • AWS Java SDK version used: 2.13.9
  • JDK version used: 1.8
  • Scala : 2.12.10
  • Kubernetes: 1.15
  • Operating System and version: Amazon Linux 2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
zoewanggcommented, May 13, 2020

Hmm, that’s odd. Could you try setting the system property as follows?

 System.setProperty(SdkSystemSetting.SYNC_HTTP_SERVICE_IMPL.property(), "software.amazon.awssdk.http.apache.ApacheSdkHttpService");
0reactions
debora-itocommented, Aug 28, 2020

Closing this, feel free to reopen if there’s any further question.

Read more comments on GitHub >

github_iconTop Results From Across the Web

software.amazon.awssdk.core.exception.SdkClientException
If HTTP client is not specified on the SDK client builder, the SDK will use ServiceLoader to find HTTP implementations on the classpath....
Read more >
aws/aws-sdk-java-v2 - Gitter
You must declare a dependency on an appropriate HTTP implementation or pass in an SdkHttpClient explicitly to the client builder. software.amazon.awssdk.core.
Read more >
AWS Simple Queue Service (SQS) - Apache Camel
Name Description Default amazonAWSHost (common) The hostname of the Amazon AWS cloud. amazonaws.com amazonSQSClient (common) Autowired To use the AmazonSQS as client. autoCreateQueue (common) Setting the...
Read more >
Introducing AWS Common Runtime HTTP Client in the AWS ...
If HTTP client is not specified on the SDK client builder, the SDK will use ServiceLoader to find HTTP implementations on the classpath....
Read more >
aws-spi-akka-http - Scaladex
This is an alternative implementation of the new aws java sdk v2 non-blocking async SPI. It provides an alternative to the built-in Netty...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found