Go to file
Frank Hassanabad 58fab48500
Fixes the unHandledPromise rejections happening from unit tests (#104017)
## Summary

We had `unHandledPromise` rejections within some of our unit tests which still pass on CI but technically those tests are not running correctly and will not catch bugs.

We were seeing them showing up like so:

```ts
PASS  x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/import_rules_route.test.ts (10.502 s)
(node:21059) UnhandledPromiseRejectionWarning: [object Object]
    at emitUnhandledRejectionWarning (internal/process/promises.js:170:15)
    at processPromiseRejections (internal/process/promises.js:247:11)
    at processTicksAndRejections (internal/process/task_queues.js:96:32)
(node:21059) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
(node:21059) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
    at emitDeprecationWarning (internal/process/promises.js:180:11)
    at processPromiseRejections (internal/process/promises.js:249:13)
    at processTicksAndRejections (internal/process/task_queues.js:96:32)
 PASS  x-pack/plugins/security_solution/server/lib/detection_engine/signals/signal_rule_alert_type.test.ts
 PASS  x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/add_prepackaged_rules_route.test.ts
 PASS  x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/update_rules_route.test.ts
(node:21059) UnhandledPromiseRejectionWarning: Error: bulk failed
    at emitUnhandledRejectionWarning (internal/process/promises.js:170:15)
    at processPromiseRejections (internal/process/promises.js:247:11)
    at processTicksAndRejections (internal/process/task_queues.js:96:32)
(node:21059) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 7)
````

You can narrow down `unHandledPromise` rejections and fix tests one by one by running the following command:
```ts
node --trace-warnings --unhandled-rejections=strict scripts/jest.js --runInBand x-pack/plugins/security_solution
```

You can manually test if I fixed them by running that command and ensuring all tests run without errors and that the process exits with a 0 for detections only by running:

```ts
node --trace-warnings --unhandled-rejections=strict scripts/jest.js --runInBand x-pack/plugins/security_solution/public/detections
```

and

```ts
node --trace-warnings --unhandled-rejections=strict scripts/jest.js --runInBand x-pack/plugins/security_solution/server/lib/detection_engine
```

### Checklist
- [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or
2021-06-30 19:34:13 -04:00
.buildkite chore(NA): moving @kbn/ui-shared-deps into bazel (#101669) 2021-06-18 16:09:31 +01:00
.ci [APM-UI][e2e] discard CI builds more often (#102217) 2021-06-16 10:01:43 +01:00
.github Move ES aggregation types to src/core (#102597) 2021-06-21 11:11:15 +01:00
api_docs Update api docs (#103310) 2021-06-29 12:29:58 -04:00
config Add config properties for HTTP security headers (#97158) 2021-04-19 13:12:45 -04:00
dev_docs [dev_docs] add tutorial for setting up a development env (#103566) 2021-06-28 19:44:29 -04:00
docs Update docs to explicitly state supported upgrade version (#103774) 2021-06-30 14:11:59 -07:00
examples Locator docs (#103129) 2021-06-28 21:44:11 +02:00
licenses Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
packages chore(NA): moving @kbn/es-archiver into bazel (#103770) 2021-06-29 23:33:02 -04:00
plugins
rfcs [SoMigV2] Fail fast if unknown document types are present in the source index (#103341) 2021-06-29 20:24:01 +02:00
scripts chore(NA): moving @kbn/spec-to-console into bazel (#103470) 2021-06-28 15:58:41 +01:00
src [Security Solutions][Detection Engine] Adds a merge strategy key to kibana.yml and updates docker to have missing keys from security solutions (#103800) 2021-06-30 15:50:05 -06:00
tasks/config [KQL] Use cache and other performance improvements (#93319) 2021-03-08 10:21:15 -07:00
test [Page layouts] Some light fixes (#103197) 2021-06-29 19:50:15 -05:00
typings Move ES aggregation types to src/core (#102597) 2021-06-21 11:11:15 +01:00
utilities Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
vars [migrations v2] Integration test for multi-node cluster. (#100957) 2021-06-28 12:49:38 -04:00
x-pack Fixes the unHandledPromise rejections happening from unit tests (#104017) 2021-06-30 19:34:13 -04:00
.backportrc.json chore(NA): adds 7.14 branch and bumps 7.x on backportrc (#103914) 2021-06-30 18:40:26 +01:00
.bazelignore chore(NA): stop grouping bazel out symlink folders (#96066) 2021-04-01 14:16:14 -05:00
.bazeliskversion chore(NA): bump bazelisk to v1.7.5 (#92905) 2021-02-26 00:48:47 +00:00
.bazelrc chore(NA): manage npm dependencies within bazel (#92864) 2021-03-03 12:37:20 -05:00
.bazelrc.common chore(NA): @kbn/pm new commands to support development on Bazel packages (#96465) 2021-04-12 20:24:19 -04:00
.bazelversion chore(NA): bazel machinery installation on kbn bootstrap (#89469) 2021-01-28 00:51:01 +00:00
.browserslistrc [browserslist] remove unnecessary browsers (#89186) 2021-01-25 16:30:18 -07:00
.editorconfig .editorconfig MDX files should follow the same rules as MD (#96942) 2021-04-13 11:40:42 -04:00
.eslintignore [packages] Move @kbn/interpreter to Bazel (#101089) 2021-06-22 09:59:20 -05:00
.eslintrc.js Add @storybook/testing-react (#103004) 2021-06-28 12:34:43 -05:00
.fossa.yml
.gitattributes
.gitignore [gitignore] only ignore snapshot.js at the root (#100840) 2021-06-07 13:42:52 -04:00
.i18nrc.json chore(NA): moving @kbn/ui-shared-deps into bazel (#101669) 2021-06-18 16:09:31 +01:00
.node-version Bump Node.js from version 14.16.1 to 14.17.0 (#100314) 2021-05-19 07:36:43 -07:00
.npmrc chore(NA): assure puppeteer_skip_chromium_download is applied across every yarn install situation (#88346) 2021-01-14 18:00:23 +00:00
.nvmrc Bump Node.js from version 14.16.1 to 14.17.0 (#100314) 2021-05-19 07:36:43 -07:00
.prettierignore [dev] Replace sass-lint with stylelint (#86177) 2021-01-15 11:52:29 -06:00
.prettierrc
.stylelintignore chore(NA): stop grouping bazel out symlink folders (#96066) 2021-04-01 14:16:14 -05:00
.stylelintrc Amsterdam helpers (#93701) 2021-03-10 10:27:16 -06:00
.telemetryrc.json [Usage collection] Collect non-default kibana configs (#97368) 2021-04-20 11:02:27 -04:00
.yarnrc chore(NA): manage npm dependencies within bazel (#92864) 2021-03-03 12:37:20 -05:00
api-documenter.json
BUILD.bazel chore(NA): moving @kbn/analytics into bazel (#98917) 2021-05-03 22:34:53 +01:00
CODE_OF_CONDUCT.md Add CODE_OF_CONDUCT.md (#87439) 2021-02-23 09:01:51 +01:00
CONTRIBUTING.md
FAQ.md
github_checks_reporter.json
Gruntfile.js Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
Jenkinsfile [CI] Don't do CI stats reporting/failures for feature branch PRs (#99668) 2021-05-10 16:38:32 -04:00
jest.config.integration.js [packages] Migrate @kbn/test to Bazel (#103122) 2021-06-29 21:16:00 -04:00
jest.config.js Remove /src/legacy (#95510) 2021-04-06 09:25:36 +02:00
kibana.d.ts Remove /src/legacy (#95510) 2021-04-06 09:25:36 +02:00
LICENSE.txt Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
NOTICE.txt [Detections] Adds automatic updating for Prebuilt Security Detection Rules package (#101846) 2021-06-24 15:31:25 -06:00
package.json eui to 34.5.2 (#103896) 2021-06-30 11:33:25 -05:00
preinstall_check.js Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
README.md
renovate.json5 Add auto-backport by default to ech renovate bot prs (#102208) 2021-06-16 12:05:56 -05:00
RISK_MATRIX.mdx Add "Risk Matrix" section to the PR template (#100649) 2021-06-02 14:43:47 +02:00
SECURITY.md
STYLEGUIDE.mdx Syntax in styleguide.mdx is breaking docs build (#99840) 2021-05-11 18:06:42 -04:00
tsconfig.base.json fix(NA): windows ts_project outside sandbox compilation (#100947) 2021-06-03 17:53:39 +01:00
tsconfig.browser.json
tsconfig.json [RAC] T-Grid is moving to a new home (#100265) 2021-06-22 18:56:33 -04:00
tsconfig.refs.json [RAC] T-Grid is moving to a new home (#100265) 2021-06-22 18:56:33 -04:00
tsconfig.types.json
TYPESCRIPT.md
WORKSPACE.bazel chore(NA): upgrade bazel rules nodejs to v3.5.1 (#101412) 2021-06-04 19:56:52 +01:00
yarn.lock eui to 34.5.2 (#103896) 2021-06-30 11:33:25 -05:00

Kibana

Kibana is your window into the Elastic Stack. Specifically, it's a browser-based analytics and search dashboard for Elasticsearch.

Getting Started

If you just want to try Kibana out, check out the Elastic Stack Getting Started Page to give it a whirl.

If you're interested in diving a bit deeper and getting a taste of Kibana's capabilities, head over to the Kibana Getting Started Page.

Using a Kibana Release

If you want to use a Kibana release in production, give it a test run, or just play around:

Building and Running Kibana, and/or Contributing Code

You might want to build Kibana locally to contribute some code, test out the latest features, or try out an open PR:

Documentation

Visit Elastic.co for the full Kibana documentation.

For information about building the documentation, see the README in elastic/docs.

Version Compatibility with Elasticsearch

Ideally, you should be running Elasticsearch and Kibana with matching version numbers. If your Elasticsearch has an older version number or a newer major number than Kibana, then Kibana will fail to run. If Elasticsearch has a newer minor or patch number than Kibana, then the Kibana Server will log a warning.

Note: The version numbers below are only examples, meant to illustrate the relationships between different types of version numbers.

Situation Example Kibana version Example ES version Outcome
Versions are the same. 5.1.2 5.1.2 💚 OK
ES patch number is newer. 5.1.2 5.1.5 ⚠️ Logged warning
ES minor number is newer. 5.1.2 5.5.0 ⚠️ Logged warning
ES major number is newer. 5.1.2 6.0.0 🚫 Fatal error
ES patch number is older. 5.1.2 5.1.0 ⚠️ Logged warning
ES minor number is older. 5.1.2 5.0.0 🚫 Fatal error
ES major number is older. 5.1.2 4.0.0 🚫 Fatal error

Questions? Problems? Suggestions?

  • If you've found a bug or want to request a feature, please create a GitHub Issue. Please check to make sure someone else hasn't already created an issue for the same topic.
  • Need help using Kibana? Ask away on our Kibana Discuss Forum and a fellow community member or Elastic engineer will be glad to help you out.