diff --git a/x-pack/legacy/plugins/watcher/public/np_ready/application/models/action/logging_action.js b/x-pack/legacy/plugins/watcher/public/np_ready/application/models/action/logging_action.js index bef094b57cc8e..1590ee62e68b4 100644 --- a/x-pack/legacy/plugins/watcher/public/np_ready/application/models/action/logging_action.js +++ b/x-pack/legacy/plugins/watcher/public/np_ready/application/models/action/logging_action.js @@ -37,7 +37,18 @@ export class LoggingAction extends BaseAction { get upstreamJson() { const result = super.upstreamJson; - const text = !!this.text.trim() ? this.text : undefined; + let text; + + if (typeof this.text === 'string') { + // If this.text is a non-empty string, we can send it to the API. + if (!!this.text.trim()) { + text = this.text; + } + } else { + // If the user incorrectly defined this.text, e.g. as an object in a JSON watch, let the API + // deal with it. + text = this.text; + } Object.assign(result, { text,