ERROR 422 - Unknown Error when using loadRideInformation.
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 293
- Forks
- 132
- PR merge metrics
- No merged PRs in 30d
Description
I think this might be a bug since this happened while following the uber example provided for Android.
https://developer.uber.com/docs/riders/ride-requests/tutorials/button/android
Library version: 0.10.1
Code:
private fun initUberRideButton(startLocation: Location?, productId: String? = null) {
val sessionConfiguration = getUberSessionConfiguration()
UberSdk.initialize(sessionConfiguration)
val rideParams = getUberRideParams(startLocation, productId)
val session = ServerTokenSession(sessionConfiguration)
val callback = getUberCallback()
buttonUberRideRequest?.setRideParameters(rideParams)
buttonUberRideRequest?.setSession(session)
buttonUberRideRequest?.setCallback(callback)
buttonUberRideRequest?.loadRideInformation()
}
// region Uber getters.
/**
* Returns callback object for uber request button.
* @return RideRequestButtonCallback object to use.
*/
private fun getUberCallback(): RideRequestButtonCallback {
return object : RideRequestButtonCallback {
override fun onRideInformationLoaded() {
requireContext().toast("Uber information loaded")
}
override fun onError(apiError: ApiError?) {
apiError?.clientErrors?.forEach {
Timber.tag(UBER_TAG).e("${it.title} ${it.code} ${it.status} ")
}
}
override fun onError(throwable: Throwable?) {
Timber.tag(UBER_TAG).e(throwable?.localizedMessage)
}
}
}
/**
* Creates a RideParameters object for Uber API.
* @param startLocation Current location of the user.
* @param productId Current id of uber car selected.
* @return A RideParameters object.
*/
private fun getUberRideParams(startLocation: Location?, productId: String?): RideParameters {
val builder = if (startLocation.isAtHome()) {
RideParameters.Builder()
.setPickupLocation(homeLocation.latitude, homeLocation.longitude, getString(R.string.home), null)
} else {
RideParameters.Builder()
.setPickupLocation(startLocation?.latitude, startLocation?.longitude, getString(R.string.your_location), null)
.setDropoffLocation(homeLocation.latitude, homeLocation.longitude, getString(R.string.home), null)
}
if (!productId.isNullOrEmpty()) {
builder.setProductId(productId)
}
return builder.build()
}
/**
* Gets the uber configuration used in the app.
* @return Session Configuration object used by the uber api.
*/
private fun getUberSessionConfiguration(): SessionConfiguration = SessionConfiguration.Builder()
.setClientId(clientID)
.setServerToken(serverToken)
.setEnvironment(SessionConfiguration.Environment.SANDBOX)
.build()
// endregion`
Error obtained from debug:
0 = {ClientError@10443}
code = null
status = 422
title = "Unknown Error"
shadow$klass = {Class@10339} "class com.uber.sdk.rides.client.error.ClientError"
shadow$monitor = -1892382548
Current result:
Button stays as ride there with uber and opens the play store.

Ride request button callback always calls onError(apiError: ApiError?) instead of onRideInformationLoaded()
Expected Behavior:
I should see the button with time estimate and price like in the example.

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue centers on initUberRideButton and the loadRideInformation call; start by comparing the Android tutorial with the shown SessionConfiguration and RideParameters. Inspect the 422 ClientError delivered to onError. Done means the callback reaches onRideInformationLoaded and the ride button displays the expected time estimate and price.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100