Skip to content

Commit

Permalink
fixing TS issue
Browse files Browse the repository at this point in the history
  • Loading branch information
cauemarcondes committed Jun 22, 2021
1 parent 2087a9d commit 75e6e28
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion x-pack/plugins/apm/server/routes/fleet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* 2.0.
*/

import Boom from '@hapi/boom';
import { i18n } from '@kbn/i18n';
import { getApmPackgePolicies } from '../lib/fleet/get_apm_package_policies';
import { createApmServerRoute } from './create_apm_server_route';
import { createApmServerRouteRepository } from './create_apm_server_route_repository';
Expand All @@ -13,7 +15,14 @@ const hasFleetDataRoute = createApmServerRoute({
endpoint: 'GET /api/apm/fleet/has_data',
options: { tags: [] },
handler: async ({ core, plugins }) => {
const fleetPluginStart = await plugins.fleet.start();
const fleetPluginStart = await plugins.fleet?.start();
if (!fleetPluginStart) {
throw Boom.internal(
i18n.translate('xpack.apm.fleet_has_data.fleetRequired', {
defaultMessage: `Fleet plugin is required`,
})
);
}
const packagePolicies = await getApmPackgePolicies({
core,
fleetPluginStart,
Expand Down

0 comments on commit 75e6e28

Please sign in to comment.