diff --git a/public/app/plugins/datasource/cloud-monitoring/CloudMonitoringMetricFindQuery.ts b/public/app/plugins/datasource/cloud-monitoring/CloudMonitoringMetricFindQuery.ts index bcc98d03bac..cbcd2a5152c 100644 --- a/public/app/plugins/datasource/cloud-monitoring/CloudMonitoringMetricFindQuery.ts +++ b/public/app/plugins/datasource/cloud-monitoring/CloudMonitoringMetricFindQuery.ts @@ -112,7 +112,7 @@ export default class CloudMonitoringMetricFindQuery { } const refId = 'handleResourceTypeQueryQueryType'; const labels = await this.datasource.getLabels(selectedMetricType, refId, projectName); - return labels['resource.type'].map(this.toFindQueryResult); + return labels['resource.type']?.map(this.toFindQueryResult) ?? []; } async handleAlignersQuery({ selectedMetricType, projectName }: CloudMonitoringVariableQuery) { diff --git a/public/app/plugins/datasource/cloud-monitoring/components/VariableQueryEditor.tsx b/public/app/plugins/datasource/cloud-monitoring/components/VariableQueryEditor.tsx index 72c0a76782e..53b139c5413 100644 --- a/public/app/plugins/datasource/cloud-monitoring/components/VariableQueryEditor.tsx +++ b/public/app/plugins/datasource/cloud-monitoring/components/VariableQueryEditor.tsx @@ -150,7 +150,7 @@ export class CloudMonitoringVariableQueryEditor extends PureComponent this.onPropsChange()); } async onMetricTypeChange(metricType: string) { @@ -158,7 +158,7 @@ export class CloudMonitoringVariableQueryEditor extends PureComponent this.onPropsChange()); } onLabelKeyChange(labelKey: string) {