From 3ca3b7f4329c76a5fdb07af428fd741a26638b76 Mon Sep 17 00:00:00 2001 From: Artur Wierzbicki Date: Tue, 11 Jan 2022 10:07:08 +0400 Subject: [PATCH] fix query over live error - getQueryData should wait for centrifuge to initialize (#43880) --- public/app/features/live/centrifuge/service.ts | 3 +++ public/app/features/query/state/runRequest.ts | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/public/app/features/live/centrifuge/service.ts b/public/app/features/live/centrifuge/service.ts index 9c52e87c2ff..d65154762e7 100644 --- a/public/app/features/live/centrifuge/service.ts +++ b/public/app/features/live/centrifuge/service.ts @@ -209,6 +209,9 @@ export class CentrifugeService implements CentrifugeSrv { * Since the initial request and subscription are on the same socket, this will support HA setups */ getQueryData: CentrifugeSrv['getQueryData'] = async (options) => { + if (!this.centrifuge.isConnected()) { + await this.connectionBlocker; + } return this.centrifuge.namedRPC('grafana.query', options.body); }; diff --git a/public/app/features/query/state/runRequest.ts b/public/app/features/query/state/runRequest.ts index 1569a56735a..370df008e9b 100644 --- a/public/app/features/query/state/runRequest.ts +++ b/public/app/features/query/state/runRequest.ts @@ -143,7 +143,8 @@ export function runRequest( }), // handle errors catchError((err) => { - console.error('runRequest.catchError', err); + const errLog = typeof err === 'string' ? err : JSON.stringify(err); + console.error('runRequest.catchError', errLog); return of({ ...state.panelData, state: LoadingState.Error,