Skip to content

[Alerting] error when creating index action in alert with invalid document #74769

@pmuellr

Description

@pmuellr

When first creating an index action in an alert, if the document entered isn't valid JSON, the alert will be saved and the document will be "set" to undefined (or is interpreted as undefined later). When the action is actually executed, the following message will get logged to the Kibana console.

server    log   [11:41:58.454] [error][plugins][taskManager][taskManager] \
  Task actions:.index "300e5510-dbe9-11ea-bbb2-2ffd95ef11d1" failed: \
  Error: error validating action params: [documents]: expected value of type [array] but got [undefined]

It doesn't appear to be possible to change an existing action with a valid document, to an invalid document. You can save it, but the old value is still used. We should be preventing the save in this case. Presumably this would prevent a customer from creating an invalid document template at create time.

I'm actually wondering if we did this on purpose, for some reason. Maybe there are cases where the JSON editor thinks something is invalid but it actually isn't?

We should also provide a better error message here - I'm not sure we can since this appears to have come from the action params validation. We could potentially "loosen" the schema here to allow the undefined value to pass through the validation, and produce a nicer error message later in the validation.

Reporting this after investigating the following discussion: https://discuss.elastic.co/t/kibana-alert-and-action-error-error-validating-action-params/244502

Metadata

Metadata

Assignees

Labels

Feature:AlertingTeam:ResponseOpsPlatform ResponseOps team (formerly the Cases and Alerting teams) t//bugFixes for quality problems that affect the customer experience

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions