Skip to content

Commit

Permalink
fix(storage): Upgrade SDK to fix EOF exception (#2558)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdhuka authored and mattcreaser committed Aug 18, 2023
1 parent 8fb9613 commit 2efdee1
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

package com.amplifyframework.api.aws.sigv4

import aws.smithy.kotlin.runtime.InternalApi
import aws.smithy.kotlin.runtime.auth.awscredentials.CredentialsProvider
import aws.smithy.kotlin.runtime.auth.awssigning.AwsSignedBodyHeader
import aws.smithy.kotlin.runtime.auth.awssigning.AwsSigningConfig
Expand All @@ -32,6 +33,7 @@ abstract class AWS4Signer(private val regionName: String) {
/**
* Async signing
*/
@OptIn(InternalApi::class)
suspend fun sign(
httpRequest: HttpRequest,
credentialsProvider: CredentialsProvider,
Expand All @@ -50,6 +52,7 @@ abstract class AWS4Signer(private val regionName: String) {
/**
* Sign synchronously
*/
@OptIn(InternalApi::class)
fun signBlocking(
httpRequest: HttpRequest,
credentialsProvider: CredentialsProvider,
Expand Down
2 changes: 2 additions & 0 deletions aws-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ dependencies {
implementation(dependency.kotlin.coroutines)

implementation(dependency.aws.credentials)
// slf4j dependency is added to fix https://github.com/awslabs/aws-sdk-kotlin/issues/993#issuecomment-1678885524
implementation(dependency.slf4j)
}

afterEvaluate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/
package com.amplifyframework.logging.cloudwatch

import aws.smithy.kotlin.runtime.InternalApi
import aws.smithy.kotlin.runtime.auth.awscredentials.CredentialsProvider
import aws.smithy.kotlin.runtime.auth.awssigning.AwsSigningConfig
import aws.smithy.kotlin.runtime.auth.awssigning.DefaultAwsSigner
Expand Down Expand Up @@ -54,6 +55,7 @@ class DefaultRemoteLoggingConstraintProvider @JvmOverloads constructor(
explicitNulls = false
}

@OptIn(InternalApi::class)
override fun fetchLoggingConfig(onSuccess: Consumer<LoggingConstraints>, onError: Consumer<Exception>) {
coroutineScope.launch {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

package com.amplifyframework.geo.maplibre.http

import aws.smithy.kotlin.runtime.InternalApi
import aws.smithy.kotlin.runtime.auth.awssigning.AwsSigningConfig
import aws.smithy.kotlin.runtime.auth.awssigning.DefaultAwsSigner
import aws.smithy.kotlin.runtime.http.Headers as AwsHeaders
Expand Down Expand Up @@ -93,6 +94,7 @@ internal class AWSRequestSignerInterceptor(
return this.url(urlBuilder.build())
}

@OptIn(InternalApi::class)
@Throws(SignCredentialsException::class)
private suspend fun signRequest(request: Request): HttpRequest {
val url = request.url
Expand All @@ -119,7 +121,7 @@ internal class AWSRequestSignerInterceptor(
url.queryParameterNames.map { name ->
url.queryParameter(name)?.let { append(name, it) }
}
},
}
)

val bodyBytes: ByteArray = getBytes(request.body)
Expand Down
7 changes: 4 additions & 3 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ dependencyResolutionManagement {
/* When updating kotlin sdk or kotlin smithy,
ensure compatible versions used in aws-sdk-kotlin root gradle.properties
*/
version(awsKotlinSdk, "0.28.0-beta") // ensure proper awsSmithyKotlin version also set
version(awsSmithyKotlin, "0.22.0") // ensure proper awsKotlinSdk version also set
version(awsKotlinSdk, "0.29.1-beta") // ensure proper awsSmithyKotlin version also set
version(awsSmithyKotlin, "0.25.0") // ensure proper awsKotlinSdk version also set

library("aws-credentials", "aws.smithy.kotlin", "aws-credentials").versionRef(awsSmithyKotlin)
library("aws-signing", "aws.smithy.kotlin", "aws-signing-default").versionRef(awsSmithyKotlin)
Expand All @@ -104,7 +104,7 @@ dependencyResolutionManagement {
library(
"aws-cognitoidentityprovider",
"aws.sdk.kotlin",
"cognitoidentityprovider",
"cognitoidentityprovider"
).versionRef(awsKotlinSdk)
library("aws-comprehend", "aws.sdk.kotlin", "comprehend").versionRef(awsKotlinSdk)
library("aws-location", "aws.sdk.kotlin", "location").versionRef(awsKotlinSdk)
Expand Down Expand Up @@ -142,6 +142,7 @@ dependencyResolutionManagement {
library("tensorflow", "org.tensorflow:tensorflow-lite:2.0.0")
library("uuidgen", "com.fasterxml.uuid:java-uuid-generator:4.0.1")
library("sqlcipher", "net.zetetic:android-database-sqlcipher:4.5.4")
library("slf4j", "org.slf4j:slf4j-api:2.0.6")
}
}
}
Expand Down

0 comments on commit 2efdee1

Please sign in to comment.