elastic / kibana

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

[Console] Unable to submit valid request bodies, 400 Bad Request Illegal unquoted character #200201

Open a03nikki opened 7 hours ago

a03nikki commented 7 hours ago

Kibana version: 8.16.0

Elasticsearch version: 8.16.0

Server OS version: ESS (Elasticsearch Service - deployment, elastic.co)

Browser version: Firefox 132.0.1 (aarch64)

Browser OS version: MacOS Sonoma 14.7.1

Original install method (e.g. download page, yum, from source, etc.): Elastic Cloud - deployment

Describe the bug: The same ingest pipelines that I used in v8.15.1 does not work in 8.16.0.

Steps to reproduce:

  1. Open a v8.15 Kibana's Dev Tools > Console
  2. Run the following
    
    PUT _ingest/pipeline/my-test1
    {
    "processors": [
    {
      "dissect": {
        "field": "message",
        "pattern": "{%{m1}} {%{m2}}"
      }
    }
    ]
    }

POST _ingest/pipeline/my-test1/_simulate { "docs": [ { "_source": { "message": "{node-1} {hot}" } } ] }

3. The expected response is as follows
```json
# PUT _ingest/pipeline/my-test1 200 OK
{
  "acknowledged": true
}
# POST _ingest/pipeline/my-test1/_simulate 200 OK
{
  "docs": [
    {
      "doc": {
        "_index": "_index",
        "_version": "-3",
        "_id": "_id",
        "_source": {
          "message": "{node-1} {hot}",
          "m1": "node-1",
          "m2": "hot"
        },
        "_ingest": {
          "timestamp": "2024-11-14T14:48:23.602594255Z"
        }
      }
    }
  ]
}
  1. Open a v8.16 Kibana's Dev Tools > Console
  2. Copy from the older version and paste into the newer version
  3. Run them
  4. Unexpected response
    # 11: PUT _ingest/pipeline/my-test1 400 Bad Request
    {
    "error": {
    "root_cause": [
      {
        "type": "parse_exception",
        "reason": "Failed to parse content to type"
      }
    ],
    "type": "parse_exception",
    "reason": "Failed to parse content to type",
    "caused_by": {
      "type": "json_parse_exception",
      "reason": """Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included in string value
    at [Source: (byte[])"{  "processors": [    {      "dissect": {        "field": "message",        "pattern": "{%{m1}}
    {%{m2}}"      }    }  ]}
    "; line: 1, column: 96]"""
    }
    },
    "status": 400
    }
    # 23: POST _ingest/pipeline/my-test1/_simulate 400 Bad Request
    {
    "error": {
    "root_cause": [
      {
        "type": "parse_exception",
        "reason": "Failed to parse content to type"
      }
    ],
    "type": "parse_exception",
    "reason": "Failed to parse content to type",
    "caused_by": {
      "type": "json_parse_exception",
      "reason": """Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included in string value
    at [Source: (byte[])"{  "docs": [    {      "_source": {        "message": "{node-1}
    {hot}"      }    }  ]}
    "; line: 1, column: 64]"""
    }
    },
    "status": 400
    }

Expected behavior: Valid Elasticsearch syntax should be accepted by Dev Tools' Console.

Screenshots (if relevant):

Image

Errors in browser console (if relevant):

Provide logs and/or server output (if relevant):

Any additional context: The UI display and features seem to be all updated with the 8.16 versions, so I suspect something inadvertently broke during the UI refresh.

The original ingest pipeline that I discovered this issue with, I was able to use curl to submit the same request body directly to Elasticsearch. It returned 200 OK, and I was able to view it in Dev Tools response just fine. But then when I try to take that display and submit it via Dev Tools, it also gave the same above error. So I am fairly certain this is a Kibana bug and not an Elasticsearch bug.

elasticmachine commented 7 hours ago

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