From 9ad0705ec7afc3d4804c07839896d88ec920ec06 Mon Sep 17 00:00:00 2001 From: nubpro Date: Tue, 11 Aug 2020 00:00:21 +0800 Subject: [PATCH] fix(@aws-amplify/pubsub): fix undefined observer (#6436) --- packages/pubsub/src/Providers/AWSAppSyncRealTimeProvider.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pubsub/src/Providers/AWSAppSyncRealTimeProvider.ts b/packages/pubsub/src/Providers/AWSAppSyncRealTimeProvider.ts index dbe610f12b2..d8e8095444a 100644 --- a/packages/pubsub/src/Providers/AWSAppSyncRealTimeProvider.ts +++ b/packages/pubsub/src/Providers/AWSAppSyncRealTimeProvider.ts @@ -511,7 +511,7 @@ export class AWSAppSyncRealTimeProvider extends AbstractPubSubProvider { private _errorDisconnect(msg: string) { logger.debug(`Disconnect error: ${msg}`); this.subscriptionObserverMap.forEach(({ observer }) => { - if (!observer.closed) { + if (observer && !observer.closed) { observer.error({ errors: [{ ...new GraphQLError(msg) }], });