Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding an incorrect e-mail alert prevents loading the Watches tab with a 500 error #18091

Closed
elasticmachine opened this issue Nov 30, 2017 · 4 comments
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Feature:Watcher

Comments

@elasticmachine
Copy link
Contributor

Original comment by @ismael-hasan:

Kibana version: 6.0 - it does not happen in 5.6

Elasticsearch version: 6.0

Server OS version: Windows 10 - does not seem OS related

Browser version: Chrome Version 62.0.3202.94 (Official Build) (64-bit)

Browser OS version: Windows 10 - does not seem OS related

Original Kibana install method (e.g. download page, yum, from source, etc.): zip

Original X-Pack install method (e.g. by name, offline install, from source, etc.): bin/kibana-plugin install x-pack

Description of the problem including expected versus actual behavior:
Adding an incorrect e-mail watch (the action not having a body section) prevents loading the Watches screen from Management. Due to the trace, it seems it only affects to the e-mail action.

This has been reported as a doc issue in beta in LINK REDACTED , but it seems a bug - being able to bring the watcher UI down by making a mistake creating an alert.

Steps to reproduce:
Create a new installation of ES and Kibana 6, with x-pack. In Elasticsearch, define an email (in the example, the email account is called gmail). In Kibana:

  1. Go to Management -> Watcher -> Create new Watch -> Advanced watch
  2. Use any name and id
  3. As body of the query use the one provided at the end of this section
  4. Save the watch (screenshot1)
  5. It redirects to the management window (screenshot2) showing the 500 error at the top
  6. Clicking on watcher in the management window shows the same behavior as in step 5

The only way to be able to access again to the Watches via the UI is to manually delete the alert:
DELETE .watches/doc/asd

email_action_1
email_action_2

An example alert body causing this issue:

{
  "trigger": {
    "schedule": {
      "interval": "30m"
    }
  },
  "input": {
    "search": {
      "request": {
        "body": {
          "size": 0,
          "query": {
            "match_all": {}
          }
        },
        "indices": [
          "*"
        ]
      }
    }
  },
  "condition": {
    "compare": {
      "ctx.payload.hits.total": {
        "gte": 10
      }
    }
  },
    "actions": {
      "sms": {
        "email": {
          "subject": "FLE status DOWN",
          "profile": "gmail",
          "to": [],
          "priority": "highest"
        }
      }
    }
}

Errors in browser console (if relevant):
Watcher: Error 500 Internal Server Error: An internal server error occurred
Provide logs and/or server output (if relevant):

error  [12:39:07.923]  Error: json argument must contain an actionJson.email.body property
   at Function.fromUpstreamJSON (D:/software/kibana/6.x/kibana-6.0.0-windows-x86_64/plugins/x-pack/plugins/watcher/server/models/action/email_action.js:71:13)
   at Function.fromUpstreamJSON (D:/software/kibana/6.x/kibana-6.0.0-windows-x86_64/plugins/x-pack/plugins/watcher/server/models/action/action.js:28:23)
   at actions (D:/software/kibana/6.x/kibana-6.0.0-windows-x86_64/plugins/x-pack/plugins/watcher/server/models/watch/base_watch.js:109:21)
   at D:\software\kibana\6.x\kibana-6.0.0-windows-x86_64\plugins\x-pack\node_modules\lodash\index.js:2275:27
   at D:\software\kibana\6.x\kibana-6.0.0-windows-x86_64\plugins\x-pack\node_modules\lodash\index.js:3073:15
   at baseForOwn (D:\software\kibana\6.x\kibana-6.0.0-windows-x86_64\plugins\x-pack\node_modules\lodash\index.js:2046:14)
   at D:\software\kibana\6.x\kibana-6.0.0-windows-x86_64\plugins\x-pack\node_modules\lodash\index.js:3043:18
   at baseMap (D:\software\kibana\6.x\kibana-6.0.0-windows-x86_64\plugins\x-pack\node_modules\lodash\index.js:2274:7)
   at map (D:\software\kibana\6.x\kibana-6.0.0-windows-x86_64\plugins\x-pack\node_modules\lodash\index.js:6710:14)
   at Function.getPropsFromUpstreamJSON (D:/software/kibana/6.x/kibana-6.0.0-windows-x86_64/plugins/x-pack/plugins/watcher/server/models/watch/base_watch.js:108:21)
   at Function.fromUpstreamJSON (D:/software/kibana/6.x/kibana-6.0.0-windows-x86_64/plugins/x-pack/plugins/watcher/server/models/watch/json_watch.js:47:29)
   at Function.fromUpstreamJSON (D:/software/kibana/6.x/kibana-6.0.0-windows-x86_64/plugins/x-pack/plugins/watcher/server/models/watch/watch.js:41:22)
   at hits.map.hit (D:/software/kibana/6.x/kibana-6.0.0-windows-x86_64/plugins/x-pack/plugins/watcher/server/routes/api/watches/register_list_route.js:41:24)
   at Array.map (native)
   at fetchWatches.then.hits (D:/software/kibana/6.x/kibana-6.0.0-windows-x86_64/plugins/x-pack/plugins/watcher/server/routes/api/watches/register_list_route.js:36:30)
   at bound (domain.js:280:14)
   at runBound (domain.js:293:12)
   at tryCatcher (D:\software\kibana\6.x\kibana-6.0.0-windows-x86_64\node_modules\bluebird\js\main\util.js:26:23)
   at Promise._settlePromiseFromHandler (D:\software\kibana\6.x\kibana-6.0.0-windows-x86_64\node_modules\bluebird\js\main\promise.js:503:31)
   at Promise._settlePromiseAt (D:\software\kibana\6.x\kibana-6.0.0-windows-x86_64\node_modules\bluebird\js\main\promise.js:577:18)
   at Async._drainQueue (D:\software\kibana\6.x\kibana-6.0.0-windows-x86_64\node_modules\bluebird\js\main\async.js:128:12)
   at Async._drainQueues (D:\software\kibana\6.x\kibana-6.0.0-windows-x86_64\node_modules\bluebird\js\main\async.js:133:10)
   at Immediate.Async.drainQueues (D:\software\kibana\6.x\kibana-6.0.0-windows-x86_64\node_modules\bluebird\js\main\async.js:15:14)
@elasticmachine
Copy link
Contributor Author

Original comment by @chrisronline:

PR to fix: LINK REDACTED

Workaround listed in comments: LINK REDACTED

@elasticmachine elasticmachine added :Management Feature:Watcher bug Fixes for quality problems that affect the customer experience labels Apr 24, 2018
@sebelga
Copy link
Contributor

sebelga commented Oct 16, 2018

@yaronp68 Apparently in the current version of the watcher plugin, the email body is not mandatory anymore. Could you confirm this? thanks!

@chrisronline
Copy link
Contributor

Correct. This was fixed in 6.1.1

@sebelga
Copy link
Contributor

sebelga commented Oct 17, 2018

Closing this issue as it was fixed in v6.1.1

@sebelga sebelga closed this as completed Oct 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:Watcher
Projects
None yet
Development

No branches or pull requests

3 participants