From 04f51603f52964d09b63eb3c8b5035671340ea69 Mon Sep 17 00:00:00 2001 From: AllanZhengYP Date: Tue, 4 Oct 2022 18:19:40 +0000 Subject: [PATCH] fix(pubsub): surface graphql connection failure error to observers --- .../src/Providers/AWSAppSyncRealTimeProvider/index.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/pubsub/src/Providers/AWSAppSyncRealTimeProvider/index.ts b/packages/pubsub/src/Providers/AWSAppSyncRealTimeProvider/index.ts index a7b3baffd49..0098e8112d6 100644 --- a/packages/pubsub/src/Providers/AWSAppSyncRealTimeProvider/index.ts +++ b/packages/pubsub/src/Providers/AWSAppSyncRealTimeProvider/index.ts @@ -593,6 +593,16 @@ export class AWSAppSyncRealTimeProvider extends AbstractPubSubProvider { `${CONTROL_MSG.CONNECTION_FAILED}: ${JSON.stringify(payload)}` ); + observer.error({ + errors: [ + { + ...new GraphQLError( + `${CONTROL_MSG.CONNECTION_FAILED}: ${JSON.stringify(payload)}` + ), + }, + ], + }); + if (startAckTimeoutId) clearTimeout(startAckTimeoutId); if (typeof subscriptionFailedCallback === 'function') {