elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.58k stars 8.09k forks source link

[Console][Monaco] Uncaught Error: Cannot read properties of undefined (reading 'split') #186766

Closed sakurai-youhei closed 1 month ago

sakurai-youhei commented 2 months ago

Kibana version: 74a202a79a116d3b56396783c465522bc56fc59c

Elasticsearch version: 8.15.0-SNAPSHOT

Server OS version: Linux wsl 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

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

Browser OS version: Windows 11 10.0.22621 N/A Build 22621

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

Describe the bug: Uncaught error is shown in the browser's dev tool; this is not observable on 8.14.1.

Steps to reproduce:

  1. Go to Kibana > Dev Tools > Console.
  2. Open the browser's console.
  3. Paste the following content to the left pane with Ctrl+a > Ctrl+v.
  4. Type in any characters at line 2.
Reproducer content ``` """ HERE """ ```

Expected behavior: No error is shown in the browser's console.

Screenshots (if relevant):

image

Errors in browser console (if relevant):

errors.js:15 Uncaught Error: Cannot read properties of undefined (reading 'split')

TypeError: Cannot read properties of undefined (reading 'split')
    at parseUrl (tokens_utils.ts:41:1)
    at parseLine (tokens_utils.ts:26:1)
    at getBodyCompletionItems (autocomplete_utils.ts:216:1)
    at MonacoEditorActionsProvider.getSuggestions (monaco_editor_actions_provider.ts:353:1)
    at errors.js:15:1
elasticmachine commented 2 months ago

Pinging @elastic/kibana-management (Team:Kibana Management)

yuliacech commented 1 month ago

The code is trying to suggest completions for request body and that throws the error. The function getAutocompleteType should not return any autocomplete type when the request is not valid.

sabarasaba commented 1 month ago

Fixed with https://github.com/elastic/kibana/pull/189200