#Error on android - no connection and no info

11 messages · Page 1 of 1 (latest)

potent slate
#

Every once in a while I am no longer able to access information on Amplify, and I get this error:
Query failure
NonRetryableException{message=OkHttp client request failed., cause=null, recoverySuggestion=Irrecoverable error}
at com.amplifyframework.api.aws.AppSyncGraphQLOperation$OkHttpCallback.onResponse(AppSyncGraphQLOperation.java:147)
at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:539)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)

The way I have been fixing it is by updating the schema and deploying it again, I add a field or something. But why does this happen? any ideas?

#

The device does have connection, but it doesn't connect to amplify for the query

real tree
#

Hello @potent slate,
The NonRetryableException with the message "OkHttp client request failed" is being thrown when the HTTP response code is in the 4xx range (Client Error Response code). These are client errors, indicating that the client seems to have made a request that the server cannot or will not process.

  1. Can you share redacted code for your API query?
  2. Is there any specific scenario when you face this error (such as when you stop and restart your app?)
  3. You have shared stacktrace which is helpful. Is it possible for you to share redacted logs by adding Amplify.addPlugin(new AndroidLoggingPlugin(LogLevel.VERBOSE)); as the first plugin.
  4. Do you have any Authorization section for model? if so make sure you follow relevant authorization steps when querying data as given here: https://docs.amplify.aws/lib/graphqlapi/authz/q/platform/android/#auth-modes
#

Here are some possible reasons you might be seeing this exception:

Incorrect Request
Request might be malformed or incorrect. Sharing more details aboput logs and your query can help to rule this out.

Authorization Errors
A 4xx error could be due to an unauthorized or forbidden request.

  1. In your application class you can try to modify AWSAPIPlugin and add okhttp Interceptor to log response code and message. So that we can know more details about http client error code and message

AWSApiPlugin plugin = AWSApiPlugin.builder()
.configureClient("YOUR_API_NAME", okHttpBuilder -> {

    okHttpBuilder.addInterceptor(new Interceptor() {
        @Override
        public Response intercept(Chain chain) throws IOException {
            Response response = chain.proceed(chain.request());

            // Log the response details
            Log.d("OkHttp", "Response Code: " + response.code());
            Log.d("OkHttp", "Response Message: " + response.message());

            return response;
        }
    });
}).build();

Amplify.addPlugin(plugin);

real tree
#

Hello @potent slate feel free to reach back after trying out above suggestions. Having more details will help us understand what is going wrong.

potent slate
# real tree Hello <@268903108753620992>, The NonRetryableException with the message "OkHttp ...

Hi @real tree
I got the error again, here is the query:

  1. attached
  2. It just happens after 7 days of updating the schema with no specific reazon that I see.
  3. I have created the schema and have this, I don't know,

I will solve it now by adding a field to a schema and pushing again. , so the issue happened exactly one week after I updated the schema and pushed it. Maybe it has to do with some configuration with 7 days on cognito? I don't know

#

I add a field to one of the schema models, and then I do a push on the CLI, and it is solved.

potent slate
#

I am getting the error again

#

exactly one week after that

haughty dune
#

Cual es la version de okhttp?