-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Location Credentials Provider is failing #1411
Comments
Hi, thanks for the report. It looks like your issue might be caused by a versioning conflict in these two versions of the SDK that are not compatible (1.2.39 & 1.2.21). Versions labelled In regards to your concern with using an alpha version of OkHttp 3 we have created an http engine for this that uses OkHttp 4.x. You can look at the readme here |
But We could not find a way to add the Could you please guide us where we can find documentation or sample code snippet that we can use ? |
Sure, here's an example of how you could use it Your build.gradle file: dependencies {
implementation("aws.sdk.kotlin:location:$SDK_VERSION") // and any other AWS SDK clients...
implementation("aws.smithy.kotlin:http-client-engine-okhttp4:$SMITHY_KOTLIN_VERSION") // depend on OkHttp4Engine
}
configurations.all {
resolutionStrategy {
// Force resolve to OkHttp 4.x
force("com.squareup.okhttp3:okhttp:4.12.0") // or whichever version you are using...
}
exclude(group = "com.squareup.okhttp3", module = "okhttp-coroutines") // Exclude dependency on okhttp-coroutines, which is introduced in 5.0.0-alpha.X
} Your code: import aws.sdk.kotlin.services.location.LocationClient
import aws.smithy.kotlin.runtime.http.engine.okhttp4.OkHttp4Engine OkHttp4Engine().use { okHttp4Engine ->
LocationClient {
httpClient = okHttp4Engine
}.use {
// Your operation `it.listKeys {}` for example
}
} |
In our case we are using AWS Location auth library as well.
In our Code:
Since we are get the authorised client via
|
Any update on forcing the |
You will want to override the client configuration of the It will look something like this: val locationCredentialsProvider: LocationCredentialsProvider = AuthHelper(context).authenticateWithCognitoIdentityPool("xxxxxxxxxx")
val locationClient: LocationClient = locationCredentialsProvider.getLocationClient()
val okHttp4Engine = OkHttp4Engine()
val overriddenLocationClient = locationClient.withConfig {
httpClient = okHttp4Engine
}
val request = SearchPlaceIndexForSuggestionsRequest {
text = "sydney"
indexName = "xxxxx"
}
val response = locationClient.searchPlaceIndexForSuggestions(request)
// Make sure to close all clients and engines when you are done using them
overriddenLocationClient.close()
okHttp4Engine.close()
locationClient.close() |
I greatly appreciate your prompt assistance in resolving this issue, as it will allow us to address the user crashes in our production app. |
After enforcing the OkHttpEngine, I am getting the following error with
|
That error suggests to me that you still have OkHttp 5.x in your dependencies somewhere. Can you please run |
|
I can see okhttp version has been forced |
It's possible your client initialization code may still be trying to use the default (OkHttp 5) engine and failing because the OkHttp 4 engine is the only one on the class path. Can you please share the code where you initialize your |
@drayan85 Can you confirm if you're still seeing the |
Yes, still when we try access location service end points we are getting the error
|
A fix for this was released today in SDK version 1.3.60. Can you retry with the latest version of the Location client and let me know if the problem is resolved? |
Any update on SDK versions 1.3.60 or later @drayan85? |
Yes, We have updated to the In the Gradle file
Code Implementation
|
I attempted to use BBy changing the gradle config as follows to use the okhttp-coroutine:5.0.0-alpha.14 :
I just remove the Android app working as expected and my Dependency Graph looks like:
|
If v1.3.62 is working for you without configuring It sounds like you've got a few working solutions, so I'll be closing this issue. Please reach out if you have further problems! |
|
Describe the bug
We are using Cognito pool ID in our Android Project to use the AWS location service.
When we try to create the
LocationCredentialProvider
(AuthHelper(context).authenticateWithCognitoIdentityPool(xxxx)
) it is failing after1.2.39
->1.3.34
with the following error:java.lang.NoClassDefFoundError: aws.sdk.kotlin.services.cognitoidentity.endpoints.internal.PartitionsKt
Regression Issue
Expected behavior
It should successfully return the
LocationCredentialsProvider
objectCurrent behavior
Throwing Exception:
Steps to Reproduce
Location demo app was working as expected when
aws.sdk.kotlin:location
=>1.2.38
and just updating this to1.2.39
in the gradle configuration started get this exception.FYI, We are not forcing the OKHTTP3 library to downgrade (Some other issue mentioning that this exception is occurred when they force downgrade to OkHttp3 to 4.x verion )
Possible Solution
Currently we are downgraded the
aws.sdk.kotlin:location
to1.2.38
and working as expected.Exception started inside the
LocationCredentialsProvider
->val getIdResponse = cognitoIdentityClient?.getId(GetIdRequest { this.identityPoolId = identityPoolId })
Context
We are far away from the latest of the library in our production app and also concern about using not stable OkHttp3 (
5.0.0-alpha.14
) library which will override by the AWS library (transient dependency) in our production appAWS SDK for Kotlin version
1.2.38
-1.3.34
Platform (JVM/JS/Native)
JVM (Kotlin)
Operating system and version
Android 13
The text was updated successfully, but these errors were encountered: