From 27123f53648289529d58f8075117282d1bfda03b Mon Sep 17 00:00:00 2001 From: Jon Wire Date: Wed, 18 Dec 2024 11:54:24 -0600 Subject: [PATCH] removed the newly added exception for missing endpoint for now; lots of testing depends on creating appsync connections to nowhere --- .../src/internals/InternalGraphQLAPI.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/packages/api-graphql/src/internals/InternalGraphQLAPI.ts b/packages/api-graphql/src/internals/InternalGraphQLAPI.ts index d25f7080f04..a1d93bd6cd9 100644 --- a/packages/api-graphql/src/internals/InternalGraphQLAPI.ts +++ b/packages/api-graphql/src/internals/InternalGraphQLAPI.ts @@ -386,17 +386,14 @@ export class InternalGraphQLAPIClass { const appSyncGraphqlEndpoint = endpoint ?? config?.endpoint; - if (!appSyncGraphqlEndpoint) { - throw new Error( - 'Endpoint missing from subscription query. An endpoint must either be configured or provided at the call site.', - ); - } - + // TODO: This could probably be an exception. But, lots of tests rely on + // attempting to connect to nowhere. So, I'm treating as the opposite of + // a Chesterton's fence for now. (A fence I shouldn't build, because I don't + // know why somethings depends on its absence!) + const memoKey = appSyncGraphqlEndpoint ?? 'none'; const realtimeProvider = - this.appSyncRealTime.get(appSyncGraphqlEndpoint!) ?? - new AWSAppSyncRealTimeProvider(); - - this.appSyncRealTime.set(appSyncGraphqlEndpoint, realtimeProvider); + this.appSyncRealTime.get(memoKey) ?? new AWSAppSyncRealTimeProvider(); + this.appSyncRealTime.set(memoKey, realtimeProvider); return realtimeProvider .subscribe(