Skip to content

Commit

Permalink
fixed crash on zpd/api/event_log/alert/84c00970-5130-11eb-9fa7/_find …
Browse files Browse the repository at this point in the history
…for non existing id
  • Loading branch information
YulNaumenko committed Jan 7, 2021
1 parent c1d7a14 commit 9c1cbd6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
11 changes: 6 additions & 5 deletions x-pack/plugins/actions/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,12 @@ export class ActionsPlugin implements Plugin<Promise<PluginSetupContract>, Plugi

this.eventLogService!.registerSavedObjectProvider('action', (request) => {
const client = secureGetActionsClientWithRequest(request);
return async (objects?: SavedObjectsBulkGetObject[]) => {
if (objects) {
Promise.all(objects.map(async (objectItem) => (await client).get({ id: objectItem.id })));
}
};
return (objects?: SavedObjectsBulkGetObject[]) =>
objects
? Promise.all(
objects.map(async (objectItem) => await (await client).get({ id: objectItem.id }))
)
: new Promise(() => []);
});

const getScopedSavedObjectsClientWithoutAccessToActions = (request: KibanaRequest) =>
Expand Down
9 changes: 4 additions & 5 deletions x-pack/plugins/alerts/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,11 +371,10 @@ export class AlertingPlugin {

this.eventLogService!.registerSavedObjectProvider('alert', (request) => {
const client = getAlertsClientWithRequest(request);
return async (objects?: SavedObjectsBulkGetObject[]) => {
if (objects) {
Promise.all(objects.map(async (objectItem) => (await client).get({ id: objectItem.id })));
}
};
return (objects?: SavedObjectsBulkGetObject[]) =>
objects
? Promise.all(objects.map(async (objectItem) => await client.get({ id: objectItem.id })))
: new Promise(() => []);
});

scheduleAlertingTelemetry(this.telemetryLogger, plugins.taskManager);
Expand Down

0 comments on commit 9c1cbd6

Please sign in to comment.