resolver_generator.js Use optional chaining when checking if plugins exists on API response (#170403)

This commit is contained in:
Mark Hopkin 2023-11-03 10:29:47 +00:00 committed by GitHub
parent 9c2652778f
commit fa8ae52b66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -337,7 +337,7 @@ export const isServerlessKibanaFlavor = async (client: KbnClient | Client): Prom
// If we don't have status for plugins, then error
// the Status API will always return something (its an open API), but if auth was successful,
// it will also return more data.
if (!kbnStatus.status.plugins) {
if (!kbnStatus?.status?.plugins) {
throw new Error(
`Unable to retrieve Kibana plugins status (likely an auth issue with the username being used for kibana)`
);