Android app crashes when access token expires with no network connection during Amplify API call

0

I am using the Flutter version of Amplify SDK for authentication and REST API for an Android app. The authentication is based on AWS user pool. The REST API is based on API Gateway and Lambda function with the access restricted to authenticated users only. Everything works fine except that if the network is disconnected when the access token expires, making an API call with Amplify.API.post the Android app will crash with the following exception: "FATAL EXCEPTION: OkHttp Dispatcher". It appears that this happens not only for the flutter version but also the Android version of the Amplify SDK. Is it possible to make the SDK throw this exception instead of crashing the app? To reproduce the issue, simply follow the Amplify Flutter tutorial for Authentication (https://docs.amplify.aws/lib/auth/getting-started/q/platform/flutter/), and for REST API (https://docs.amplify.aws/lib/restapi/getting-started/q/platform/flutter/). When creating the REST API, please choose "Restrict API access" for "Authenticated users only". By default, the access token expires in 60 minutes and then you can turn on Airplane mode and make an API call to observe the app crash.

No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions