awslabs / aws-mobile-appsync-sdk-android

Android SDK for AWS AppSync.
https://docs.amplify.aws/sdk/api/graphql/q/platform/android/
Apache License 2.0
105 stars 58 forks source link

Subscription failed #243

Closed rahatshahzeb closed 4 years ago

rahatshahzeb commented 4 years ago

Description Subscription throws exception when attached:

com.apollographql.apollo.exception.ApolloException: Subscription failed.
    at com.amazonaws.mobileconnectors.appsync.WebSocketConnectionManager.notifyFailure(WebSocketConnectionManager.java:212)
    at com.amazonaws.mobileconnectors.appsync.WebSocketConnectionManager.access$400(WebSocketConnectionManager.java:39)
    at com.amazonaws.mobileconnectors.appsync.WebSocketConnectionManager$1.onFailure(WebSocketConnectionManager.java:141)
    at okhttp3.internal.ws.RealWebSocket.failWebSocket(RealWebSocket.java:546)
    at okhttp3.internal.ws.RealWebSocket$2.onResponse(RealWebSocket.java:188)
    at okhttp3.RealCall$AsyncCall.execute(RealCall.java:153)
    at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    at java.lang.Thread.run(Thread.java:764)
Caused by: java.net.ProtocolException: Expected HTTP 101 response but was '401 Unauthorized'
    at okhttp3.internal.ws.RealWebSocket.checkResponse(RealWebSocket.java:219)
    at okhttp3.internal.ws.RealWebSocket$2.onResponse(RealWebSocket.java:186)
    ... 5 more

Environment:

Device Information:

rahatshahzeb commented 4 years ago

This started happening when I updated the appsync sdk version from 2.7.8 to 3.0.0. Seems like I have to update my code as well. I have reverted back the version for now as it broke everything.