awslabs / awslabs/aws-mobile-appsync-sdk-android

No callback triggered after executing query

Open
#335 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
106
Forks
56
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
A clear and concise description of what the bug is.

We run a version check by querying appsync when the onUserStateChanged userstate == SIGNED_IN.

Sometimes this version check fails to complete, no failure, no timeout, no response. This usually only happens once when the app is first started, when closing and reopening the app it works.

This problem typically happens when a user opens the app for the first time

**To Reproduce**
Steps to reproduce the behavior:
```

override fun onUserStateChanged(details: UserStateDetails) {
when (details.userState) {
UserState.SIGNED_IN -> {
versionCheck() // queries appsyync for version info
}

// more cases

}
}

fun versionCheck() {
let versionCode = 1
let versionName = 1.0.0

val query = GetVersionInfoQuery.builder().versionCode(versionCode).versionName(versionName).build()
client.query(query)
.responseFetcher(NETWORK_ONLY)
.enqueue(object : GraphQLCall.Callback() {
override fun onResponse(@Nonnull response: Response) {

// Handle Success (never called)

}

override fun onFailure(@Nonnull e: ApolloException) {

// Handle Fail (never called)

}
})
}
```

**Expected behavior**
A clear and concise description of what you expected to happen.

Execute the query, and get a response either success or failure.

**Environment(please complete the following information):**
- 3.1.3

**Device Information (please complete the following information):**
- Pixel 2 Android 21-30 (simulator)
- Samsung S10+ Real device

Contributor guide

Open the contributing guide

Research direction

Start by tracing the onUserStateChanged SIGNED_IN path and the client.query(...).enqueue callback shown in the report. Reproduce the first-launch case on the listed simulator or device, then inspect the SDK's query execution and callback handling until the request consistently reaches either onResponse or onFailure.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, graphql, java
Domain
api, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.