我正在开发基于AWS Amplify的应用程序。在第二台本地设备上进行测试时,我注意到每个graphQL查询均失败,返回高速缓存未命中和/或网络错误。最有可能取决于使用哪个AppSyncResponseFetchers。我先尝试过网络,也只尝试过网络,但是查询仍然失败。
如果我在仿真器上打开应用程序,或者在其他设备上没有出现任何错误,那么它使我有理由相信这不是配置错误。我尝试卸载并重新安装该应用程序,但是它不起作用。
关于此问题的根源有何想法?
2019-03-17 17:24:44.718 32349-32559/com.myapp.android E/myapp.AWSDataService: Error during GraphQL Operation: Cache miss for operation com.amazonaws.amplify.generated.graphql.AmNewUserQuery@f7cd3d7
com.apollographql.apollo.exception.ApolloException: Cache miss for operation com.amazonaws.amplify.generated.graphql.AmNewUserQuery@f7cd3d7
at com.apollographql.apollo.internal.interceptor.ApolloCacheInterceptor.resolveFromCache(ApolloCacheInterceptor.java:138)
at com.apollographql.apollo.internal.interceptor.ApolloCacheInterceptor.access$100(ApolloCacheInterceptor.java:53)
at com.apollographql.apollo.internal.interceptor.ApolloCacheInterceptor$1.run(ApolloCacheInterceptor.java:78)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
2019-03-17 17:24:44.720 32349-32600/com.myapp.android D/RetryInterceptor: Encountered non-retriable error. Returning response
2019-03-17 17:24:44.721 32349-32600/com.myapp.android E/myapp.AWSDataService: Error during GraphQL Operation: HTTP 403
com.apollographql.apollo.exception.ApolloHttpException: HTTP 403
at com.apollographql.apollo.internal.interceptor.ApolloParseInterceptor.parse(ApolloParseInterceptor.java:147)
at com.apollographql.apollo.internal.interceptor.ApolloParseInterceptor.access$100(ApolloParseInterceptor.java:54)
at com.apollographql.apollo.internal.interceptor.ApolloParseInterceptor$1.onResponse(ApolloParseInterceptor.java:83)
at com.apollographql.apollo.internal.interceptor.ApolloServerInterceptor$1$1.onResponse(ApolloServerInterceptor.java:110)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:141)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
编辑: Appsync版本:2.7+(也是2.7.0)
设备1:三星Galaxy S9 + Android 28(正在运行)
设备2:HTC 10 Android 26(失败)
仿真器1:Pixel 2 Android 27(正常运行)
仿真器1:Pixel 2 Android 25(正在运行)
我之前曾在我的主设备上针对特定查询看到过此问题。显然,我不知道到底是什么引起了该问题,但我能够解决该问题,方法是登录到我的AWS账户并重新保存了解析程序。在不对解析程序进行任何功能更改的情况下,它又开始工作。
编辑2:
使用android调试器,403错误是由InvalidSignatureException“来自Cloudfront的错误”引起的
可能与之相关:Amazon API Gateway IAM authenticated example with generated JS SDK