-
Notifications
You must be signed in to change notification settings - Fork 920
Description
Hi,
I'm trying to do a GetObject() call from S3 using an SBT project. When I try to run the project within my IDE, or do "sbt run", things work -- that is, I'm able to read a file from S3, and do what I need to do with it.
However, when I do "sbt assembly" to get an uber jar (which I plan on uploading to an AWS Lambda), I end up with the below exception:
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 tried doing something like below, but to no avail. Exact same behaviour as before I tried to explicitly create an HttpClient.
val apacheClient: SdkHttpClient = ApacheSdkHttpClientFactory.builder()
.build()
.createHttpClient()
val client = S3Client.builder()
.httpConfiguration(ClientHttpConfiguration.builder()
.httpClient(apacheClient)
.build())
.region(Region.US_EAST_1)
.build()
val stream: ResponseInputStream[GetObjectResponse] = client.getObject(GetObjectRequest.builder()
.bucket(s3Bucket)
.key(s3EventKey)
.build())
the lib dependencies look like this on my build.sbt:
libraryDependencies ++=
Seq(
"org.apache.kafka" %% "kafka" % "1.0.0",
"com.typesafe" % "config" % "1.3.1",
// "com.fasterxml.jackson.core" % "jackson-core" % "2.9.1",
// "com.fasterxml.jackson.core" % "jackson-databind" % "2.9.1",
"org.apache.avro" % "avro" % "1.8.2",
"io.confluent" % "kafka-avro-serializer" % "3.3.1",
// "com.typesafe.play" %% "play-json" % "2.6.7",
// "com.typesafe.akka" %% "akka-http" % "10.0.11",
//"software.amazon.awssdk" % "dynamodb" % "2.0.0-preview-2",
"software.amazon.awssdk" % "dynamodb" % "2.0.0-preview-9",
"software.amazon.awssdk" % "core" % "2.0.0-preview-9",
// "com.amazonaws" % "aws-java-sdk" % "1.11.297",
"com.amazonaws" % "aws-lambda-java-core" % "1.2.0",
"com.amazonaws" % "aws-lambda-java-events" % "2.1.0",
// "com.amazonaws" % "aws-java-sdk-s3" % "1.11.301",
"software.amazon.awssdk" % "sts" % "2.0.0-preview-9",
"software.amazon.awssdk" % "s3" % "2.0.0-preview-9",
"software.amazon.awssdk" % "aws-http-client-apache" % "2.0.0-preview-1"
)
Your Environment
- AWS Java SDK version used: 2.0
- JDK version used: 1.8
- Operating System and version: Mac OS High Sierra (although I get the same exception after uploading and running the uber jar on an AWS lambda function).