From 593dd8b4f502bf0edebb495ce86f03204dc84758 Mon Sep 17 00:00:00 2001 From: sdhuka Date: Fri, 11 Aug 2023 14:14:47 -0500 Subject: [PATCH 1/3] fix(storage): Upgrade SDK to fix EOF exception --- .../java/com/amplifyframework/api/aws/sigv4/AWS4Signer.kt | 3 +++ settings.gradle.kts | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/aws-api/src/main/java/com/amplifyframework/api/aws/sigv4/AWS4Signer.kt b/aws-api/src/main/java/com/amplifyframework/api/aws/sigv4/AWS4Signer.kt index 62435dde15..99b8de5799 100644 --- a/aws-api/src/main/java/com/amplifyframework/api/aws/sigv4/AWS4Signer.kt +++ b/aws-api/src/main/java/com/amplifyframework/api/aws/sigv4/AWS4Signer.kt @@ -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 @@ -32,6 +33,7 @@ abstract class AWS4Signer(private val regionName: String) { /** * Async signing */ + @OptIn(InternalApi::class) suspend fun sign( httpRequest: HttpRequest, credentialsProvider: CredentialsProvider, @@ -50,6 +52,7 @@ abstract class AWS4Signer(private val regionName: String) { /** * Sign synchronously */ + @OptIn(InternalApi::class) fun signBlocking( httpRequest: HttpRequest, credentialsProvider: CredentialsProvider, diff --git a/settings.gradle.kts b/settings.gradle.kts index 46c6b09236..73a52e8c53 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -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) @@ -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) From 4c9c0cd83251b48091cdd054ac186bcbc32c2ed4 Mon Sep 17 00:00:00 2001 From: sdhuka Date: Mon, 14 Aug 2023 13:55:32 -0500 Subject: [PATCH 2/3] fix compile errors --- .../cloudwatch/DefaultRemoteLoggingConstraintProvider.kt | 2 ++ .../geo/maplibre/http/AWSRequestSignerInterceptor.kt | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/aws-logging-cloudwatch/src/main/java/com/amplifyframework/logging/cloudwatch/DefaultRemoteLoggingConstraintProvider.kt b/aws-logging-cloudwatch/src/main/java/com/amplifyframework/logging/cloudwatch/DefaultRemoteLoggingConstraintProvider.kt index 4e3d517cc9..89f6612d1d 100644 --- a/aws-logging-cloudwatch/src/main/java/com/amplifyframework/logging/cloudwatch/DefaultRemoteLoggingConstraintProvider.kt +++ b/aws-logging-cloudwatch/src/main/java/com/amplifyframework/logging/cloudwatch/DefaultRemoteLoggingConstraintProvider.kt @@ -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 @@ -54,6 +55,7 @@ class DefaultRemoteLoggingConstraintProvider @JvmOverloads constructor( explicitNulls = false } + @OptIn(InternalApi::class) override fun fetchLoggingConfig(onSuccess: Consumer, onError: Consumer) { coroutineScope.launch { try { diff --git a/maplibre-adapter/src/main/java/com/amplifyframework/geo/maplibre/http/AWSRequestSignerInterceptor.kt b/maplibre-adapter/src/main/java/com/amplifyframework/geo/maplibre/http/AWSRequestSignerInterceptor.kt index c8214601d2..1a73511c71 100644 --- a/maplibre-adapter/src/main/java/com/amplifyframework/geo/maplibre/http/AWSRequestSignerInterceptor.kt +++ b/maplibre-adapter/src/main/java/com/amplifyframework/geo/maplibre/http/AWSRequestSignerInterceptor.kt @@ -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 @@ -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 @@ -119,7 +121,7 @@ internal class AWSRequestSignerInterceptor( url.queryParameterNames.map { name -> url.queryParameter(name)?.let { append(name, it) } } - }, + } ) val bodyBytes: ByteArray = getBytes(request.body) From acdf05fd4b626fc56692e828d97994d1f89b88eb Mon Sep 17 00:00:00 2001 From: sdhuka Date: Tue, 15 Aug 2023 08:58:06 -0500 Subject: [PATCH 3/3] add slf4j dependency --- aws-core/build.gradle.kts | 2 ++ settings.gradle.kts | 1 + 2 files changed, 3 insertions(+) diff --git a/aws-core/build.gradle.kts b/aws-core/build.gradle.kts index eb799fb7f8..64c302675c 100644 --- a/aws-core/build.gradle.kts +++ b/aws-core/build.gradle.kts @@ -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 { diff --git a/settings.gradle.kts b/settings.gradle.kts index 73a52e8c53..fe4f29658d 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -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") } } }