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.

回答なし

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ