[Console] Fix output for empty response body#218104
[Console] Fix output for empty response body#218104ElenaStoeva merged 3 commits intoelastic:mainfrom
Conversation
|
Pinging @elastic/kibana-management (Team:Kibana Management) |
💚 Build Succeeded
Metrics [docs]Async chunks
History
cc @ElenaStoeva |
mattkime
left a comment
There was a problem hiding this comment.
Changes are good and work well, thanks!
|
Starting backport for target branches: 8.x, 9.0 https://github.com/elastic/kibana/actions/runs/14456687640 |
Fixes elastic#217433 ## Summary This PR fixes the Console output when the response body is an empty string. In elastic#199975, we made Console to display an `OK` output if the status code is 200 but response body is `null`. Previously, `POST /_cluster/voting_config_exclusions?node_names=node` returned `null` and so the output was correctly set to `OK` but now the response is an empty string and this case isn't covered correctly. In this PR, we make sure to perform the right check at the right point so that both `null` and empty strings are covered. The test that covers this scenario and had failures: https://github.com/elastic/kibana/blob/7092e79157cb8abb229131a1607369324d10969f/src/platform/test/functional/apps/console/_console.ts#L258 To run the failing test with the new Es snapshots: ``` ES_SNAPSHOT_MANIFEST="https://storage.googleapis.com/kibana-ci-es-snapshots-daily/8.19.0/archives/20250414-022022_f16f4ce6/manifest.json" node scripts/functional_tests_server.js --config ./src/platform/test/functional/apps/console/config.ts ``` and ``` ES_SNAPSHOT_MANIFEST="https://storage.googleapis.com/kibana-ci-es-snapshots-daily/9.1.0/archives/20250414-021844_4ed1a000/manifest.json" node scripts/functional_test_runner.js --config ./src/platform/test/functional/apps/console/config.ts --grep="Shows OK when status code is 200 but body is empty" ``` (cherry picked from commit 170651a)
Fixes elastic#217433 ## Summary This PR fixes the Console output when the response body is an empty string. In elastic#199975, we made Console to display an `OK` output if the status code is 200 but response body is `null`. Previously, `POST /_cluster/voting_config_exclusions?node_names=node` returned `null` and so the output was correctly set to `OK` but now the response is an empty string and this case isn't covered correctly. In this PR, we make sure to perform the right check at the right point so that both `null` and empty strings are covered. The test that covers this scenario and had failures: https://github.com/elastic/kibana/blob/7092e79157cb8abb229131a1607369324d10969f/src/platform/test/functional/apps/console/_console.ts#L258 To run the failing test with the new Es snapshots: ``` ES_SNAPSHOT_MANIFEST="https://storage.googleapis.com/kibana-ci-es-snapshots-daily/8.19.0/archives/20250414-022022_f16f4ce6/manifest.json" node scripts/functional_tests_server.js --config ./src/platform/test/functional/apps/console/config.ts ``` and ``` ES_SNAPSHOT_MANIFEST="https://storage.googleapis.com/kibana-ci-es-snapshots-daily/9.1.0/archives/20250414-021844_4ed1a000/manifest.json" node scripts/functional_test_runner.js --config ./src/platform/test/functional/apps/console/config.ts --grep="Shows OK when status code is 200 but body is empty" ``` (cherry picked from commit 170651a)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
# Backport This will backport the following commits from `main` to `8.x`: - [[Console] Fix output for empty response body (#218104)](#218104) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Elena Stoeva","email":"59341489+ElenaStoeva@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-04-14T22:06:14Z","message":"[Console] Fix output for empty response body (#218104)\n\nFixes https://github.com/elastic/kibana/issues/217433\n\n## Summary\n\nThis PR fixes the Console output when the response body is an empty\nstring.\n\nIn #199975, we made Console to\ndisplay an `OK` output if the status code is 200 but response body is\n`null`. Previously, `POST\n/_cluster/voting_config_exclusions?node_names=node` returned `null` and\nso the output was correctly set to `OK` but now the response is an empty\nstring and this case isn't covered correctly. In this PR, we make sure\nto perform the right check at the right point so that both `null` and\nempty strings are covered.\n\nThe test that covers this scenario and had failures:\nhttps://github.com/elastic/kibana/blob/7092e79157cb8abb229131a1607369324d10969f/src/platform/test/functional/apps/console/_console.ts#L258\n\n\nTo run the failing test with the new Es snapshots:\n\n```\nES_SNAPSHOT_MANIFEST=\"https://storage.googleapis.com/kibana-ci-es-snapshots-daily/8.19.0/archives/20250414-022022_f16f4ce6/manifest.json\" node scripts/functional_tests_server.js --config ./src/platform/test/functional/apps/console/config.ts\n```\n\nand \n\n```\nES_SNAPSHOT_MANIFEST=\"https://storage.googleapis.com/kibana-ci-es-snapshots-daily/9.1.0/archives/20250414-021844_4ed1a000/manifest.json\" node scripts/functional_test_runner.js --config ./src/platform/test/functional/apps/console/config.ts --grep=\"Shows OK when status code is 200 but body is empty\"\n```","sha":"170651ac78595f6fe8e2ab4924fd5300b8a4f14e","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Console","Team:Kibana Management","release_note:skip","backport:prev-minor","v9.1.0","v8.19.0"],"title":"[Console] Fix output for empty response body","number":218104,"url":"https://github.com/elastic/kibana/pull/218104","mergeCommit":{"message":"[Console] Fix output for empty response body (#218104)\n\nFixes https://github.com/elastic/kibana/issues/217433\n\n## Summary\n\nThis PR fixes the Console output when the response body is an empty\nstring.\n\nIn #199975, we made Console to\ndisplay an `OK` output if the status code is 200 but response body is\n`null`. Previously, `POST\n/_cluster/voting_config_exclusions?node_names=node` returned `null` and\nso the output was correctly set to `OK` but now the response is an empty\nstring and this case isn't covered correctly. In this PR, we make sure\nto perform the right check at the right point so that both `null` and\nempty strings are covered.\n\nThe test that covers this scenario and had failures:\nhttps://github.com/elastic/kibana/blob/7092e79157cb8abb229131a1607369324d10969f/src/platform/test/functional/apps/console/_console.ts#L258\n\n\nTo run the failing test with the new Es snapshots:\n\n```\nES_SNAPSHOT_MANIFEST=\"https://storage.googleapis.com/kibana-ci-es-snapshots-daily/8.19.0/archives/20250414-022022_f16f4ce6/manifest.json\" node scripts/functional_tests_server.js --config ./src/platform/test/functional/apps/console/config.ts\n```\n\nand \n\n```\nES_SNAPSHOT_MANIFEST=\"https://storage.googleapis.com/kibana-ci-es-snapshots-daily/9.1.0/archives/20250414-021844_4ed1a000/manifest.json\" node scripts/functional_test_runner.js --config ./src/platform/test/functional/apps/console/config.ts --grep=\"Shows OK when status code is 200 but body is empty\"\n```","sha":"170651ac78595f6fe8e2ab4924fd5300b8a4f14e"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/218104","number":218104,"mergeCommit":{"message":"[Console] Fix output for empty response body (#218104)\n\nFixes https://github.com/elastic/kibana/issues/217433\n\n## Summary\n\nThis PR fixes the Console output when the response body is an empty\nstring.\n\nIn #199975, we made Console to\ndisplay an `OK` output if the status code is 200 but response body is\n`null`. Previously, `POST\n/_cluster/voting_config_exclusions?node_names=node` returned `null` and\nso the output was correctly set to `OK` but now the response is an empty\nstring and this case isn't covered correctly. In this PR, we make sure\nto perform the right check at the right point so that both `null` and\nempty strings are covered.\n\nThe test that covers this scenario and had failures:\nhttps://github.com/elastic/kibana/blob/7092e79157cb8abb229131a1607369324d10969f/src/platform/test/functional/apps/console/_console.ts#L258\n\n\nTo run the failing test with the new Es snapshots:\n\n```\nES_SNAPSHOT_MANIFEST=\"https://storage.googleapis.com/kibana-ci-es-snapshots-daily/8.19.0/archives/20250414-022022_f16f4ce6/manifest.json\" node scripts/functional_tests_server.js --config ./src/platform/test/functional/apps/console/config.ts\n```\n\nand \n\n```\nES_SNAPSHOT_MANIFEST=\"https://storage.googleapis.com/kibana-ci-es-snapshots-daily/9.1.0/archives/20250414-021844_4ed1a000/manifest.json\" node scripts/functional_test_runner.js --config ./src/platform/test/functional/apps/console/config.ts --grep=\"Shows OK when status code is 200 but body is empty\"\n```","sha":"170651ac78595f6fe8e2ab4924fd5300b8a4f14e"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Elena Stoeva <59341489+ElenaStoeva@users.noreply.github.com>
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
# Backport This will backport the following commits from `main` to `9.0`: - [[Console] Fix output for empty response body (#218104)](#218104) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Elena Stoeva","email":"59341489+ElenaStoeva@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-04-14T22:06:14Z","message":"[Console] Fix output for empty response body (#218104)\n\nFixes https://github.com/elastic/kibana/issues/217433\n\n## Summary\n\nThis PR fixes the Console output when the response body is an empty\nstring.\n\nIn #199975, we made Console to\ndisplay an `OK` output if the status code is 200 but response body is\n`null`. Previously, `POST\n/_cluster/voting_config_exclusions?node_names=node` returned `null` and\nso the output was correctly set to `OK` but now the response is an empty\nstring and this case isn't covered correctly. In this PR, we make sure\nto perform the right check at the right point so that both `null` and\nempty strings are covered.\n\nThe test that covers this scenario and had failures:\nhttps://github.com/elastic/kibana/blob/7092e79157cb8abb229131a1607369324d10969f/src/platform/test/functional/apps/console/_console.ts#L258\n\n\nTo run the failing test with the new Es snapshots:\n\n```\nES_SNAPSHOT_MANIFEST=\"https://storage.googleapis.com/kibana-ci-es-snapshots-daily/8.19.0/archives/20250414-022022_f16f4ce6/manifest.json\" node scripts/functional_tests_server.js --config ./src/platform/test/functional/apps/console/config.ts\n```\n\nand \n\n```\nES_SNAPSHOT_MANIFEST=\"https://storage.googleapis.com/kibana-ci-es-snapshots-daily/9.1.0/archives/20250414-021844_4ed1a000/manifest.json\" node scripts/functional_test_runner.js --config ./src/platform/test/functional/apps/console/config.ts --grep=\"Shows OK when status code is 200 but body is empty\"\n```","sha":"170651ac78595f6fe8e2ab4924fd5300b8a4f14e","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Console","Team:Kibana Management","release_note:skip","backport:prev-minor","v9.1.0","v8.19.0"],"title":"[Console] Fix output for empty response body","number":218104,"url":"https://github.com/elastic/kibana/pull/218104","mergeCommit":{"message":"[Console] Fix output for empty response body (#218104)\n\nFixes https://github.com/elastic/kibana/issues/217433\n\n## Summary\n\nThis PR fixes the Console output when the response body is an empty\nstring.\n\nIn #199975, we made Console to\ndisplay an `OK` output if the status code is 200 but response body is\n`null`. Previously, `POST\n/_cluster/voting_config_exclusions?node_names=node` returned `null` and\nso the output was correctly set to `OK` but now the response is an empty\nstring and this case isn't covered correctly. In this PR, we make sure\nto perform the right check at the right point so that both `null` and\nempty strings are covered.\n\nThe test that covers this scenario and had failures:\nhttps://github.com/elastic/kibana/blob/7092e79157cb8abb229131a1607369324d10969f/src/platform/test/functional/apps/console/_console.ts#L258\n\n\nTo run the failing test with the new Es snapshots:\n\n```\nES_SNAPSHOT_MANIFEST=\"https://storage.googleapis.com/kibana-ci-es-snapshots-daily/8.19.0/archives/20250414-022022_f16f4ce6/manifest.json\" node scripts/functional_tests_server.js --config ./src/platform/test/functional/apps/console/config.ts\n```\n\nand \n\n```\nES_SNAPSHOT_MANIFEST=\"https://storage.googleapis.com/kibana-ci-es-snapshots-daily/9.1.0/archives/20250414-021844_4ed1a000/manifest.json\" node scripts/functional_test_runner.js --config ./src/platform/test/functional/apps/console/config.ts --grep=\"Shows OK when status code is 200 but body is empty\"\n```","sha":"170651ac78595f6fe8e2ab4924fd5300b8a4f14e"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/218104","number":218104,"mergeCommit":{"message":"[Console] Fix output for empty response body (#218104)\n\nFixes https://github.com/elastic/kibana/issues/217433\n\n## Summary\n\nThis PR fixes the Console output when the response body is an empty\nstring.\n\nIn #199975, we made Console to\ndisplay an `OK` output if the status code is 200 but response body is\n`null`. Previously, `POST\n/_cluster/voting_config_exclusions?node_names=node` returned `null` and\nso the output was correctly set to `OK` but now the response is an empty\nstring and this case isn't covered correctly. In this PR, we make sure\nto perform the right check at the right point so that both `null` and\nempty strings are covered.\n\nThe test that covers this scenario and had failures:\nhttps://github.com/elastic/kibana/blob/7092e79157cb8abb229131a1607369324d10969f/src/platform/test/functional/apps/console/_console.ts#L258\n\n\nTo run the failing test with the new Es snapshots:\n\n```\nES_SNAPSHOT_MANIFEST=\"https://storage.googleapis.com/kibana-ci-es-snapshots-daily/8.19.0/archives/20250414-022022_f16f4ce6/manifest.json\" node scripts/functional_tests_server.js --config ./src/platform/test/functional/apps/console/config.ts\n```\n\nand \n\n```\nES_SNAPSHOT_MANIFEST=\"https://storage.googleapis.com/kibana-ci-es-snapshots-daily/9.1.0/archives/20250414-021844_4ed1a000/manifest.json\" node scripts/functional_test_runner.js --config ./src/platform/test/functional/apps/console/config.ts --grep=\"Shows OK when status code is 200 but body is empty\"\n```","sha":"170651ac78595f6fe8e2ab4924fd5300b8a4f14e"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> --------- Co-authored-by: Elena Stoeva <59341489+ElenaStoeva@users.noreply.github.com> Co-authored-by: Elena Stoeva <elenastoeva99@gmail.com>
|
Hi @mattkime @ElenaStoeva looks like since that change we are not showing body for any errors even when there is a body it is expected? it seems to me there is still some value for users to get that body no?
|
|
Hi @nchaulet, can you provide the request that caused this response? |
|
Sure here it is, any non 200 seems to trigger that response even if there is a body |
Follow-up to #218104 (comment) ## Summary This PR fixes the Console output when the HTTP request to the server fails with a non-empty error body. In #218104, we incorrectly set the output to be `Request failed to get to the server (status code: ' + statusCode + ')` even if there is an error body. In this PR, we make sure to display the error body if it's non-empty. **How to test:** Send a request that fails and verify that the error body is displayed: ``` POST kbn:/api/alerting/rule/3603c386-9102-4c74-800d-2242e52bec98 { "name": "Alert on status change", "rule_type_id": ".es-querya" } ``` <img width="1160" alt="Screenshot 2025-04-24 at 14 41 57" src="https://github.com/user-attachments/assets/ced78171-4924-477f-ba2f-d5812bff1678" />
Follow-up to elastic#218104 (comment) ## Summary This PR fixes the Console output when the HTTP request to the server fails with a non-empty error body. In elastic#218104, we incorrectly set the output to be `Request failed to get to the server (status code: ' + statusCode + ')` even if there is an error body. In this PR, we make sure to display the error body if it's non-empty. **How to test:** Send a request that fails and verify that the error body is displayed: ``` POST kbn:/api/alerting/rule/3603c386-9102-4c74-800d-2242e52bec98 { "name": "Alert on status change", "rule_type_id": ".es-querya" } ``` <img width="1160" alt="Screenshot 2025-04-24 at 14 41 57" src="https://github.com/user-attachments/assets/ced78171-4924-477f-ba2f-d5812bff1678" /> (cherry picked from commit cb0acc1)
… (#219295) # Backport This will backport the following commits from `main` to `8.19`: - [[Console] Fix output when HTTP request to server fails (#219073)](#219073) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Elena Stoeva","email":"59341489+ElenaStoeva@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-04-25T17:09:09Z","message":"[Console] Fix output when HTTP request to server fails (#219073)\n\nFollow-up to\nhttps://github.com//pull/218104#issuecomment-2824757130\n\n## Summary\n\nThis PR fixes the Console output when the HTTP request to the server\nfails with a non-empty error body. In\nhttps://github.com//pull/218104, we incorrectly set the\noutput to be `Request failed to get to the server (status code: ' +\nstatusCode + ')` even if there is an error body. In this PR, we make\nsure to display the error body if it's non-empty.\n\n**How to test:**\n\nSend a request that fails and verify that the error body is displayed:\n\n```\nPOST kbn:/api/alerting/rule/3603c386-9102-4c74-800d-2242e52bec98\n{\n \"name\": \"Alert on status change\",\n \"rule_type_id\": \".es-querya\"\n}\n```\n<img width=\"1160\" alt=\"Screenshot 2025-04-24 at 14 41 57\"\nsrc=\"https://github.com/user-attachments/assets/ced78171-4924-477f-ba2f-d5812bff1678\"\n/>","sha":"cb0acc16ee85e4dccc67dcb69dbbba3f328accad","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Console","Team:Kibana Management","release_note:skip","backport:prev-minor","v9.1.0","v8.19.0","v8.18.1","v9.0.1"],"title":"[Console] Fix output when HTTP request to server fails","number":219073,"url":"https://github.com/elastic/kibana/pull/219073","mergeCommit":{"message":"[Console] Fix output when HTTP request to server fails (#219073)\n\nFollow-up to\nhttps://github.com//pull/218104#issuecomment-2824757130\n\n## Summary\n\nThis PR fixes the Console output when the HTTP request to the server\nfails with a non-empty error body. In\nhttps://github.com//pull/218104, we incorrectly set the\noutput to be `Request failed to get to the server (status code: ' +\nstatusCode + ')` even if there is an error body. In this PR, we make\nsure to display the error body if it's non-empty.\n\n**How to test:**\n\nSend a request that fails and verify that the error body is displayed:\n\n```\nPOST kbn:/api/alerting/rule/3603c386-9102-4c74-800d-2242e52bec98\n{\n \"name\": \"Alert on status change\",\n \"rule_type_id\": \".es-querya\"\n}\n```\n<img width=\"1160\" alt=\"Screenshot 2025-04-24 at 14 41 57\"\nsrc=\"https://github.com/user-attachments/assets/ced78171-4924-477f-ba2f-d5812bff1678\"\n/>","sha":"cb0acc16ee85e4dccc67dcb69dbbba3f328accad"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","8.18","9.0"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/219073","number":219073,"mergeCommit":{"message":"[Console] Fix output when HTTP request to server fails (#219073)\n\nFollow-up to\nhttps://github.com//pull/218104#issuecomment-2824757130\n\n## Summary\n\nThis PR fixes the Console output when the HTTP request to the server\nfails with a non-empty error body. In\nhttps://github.com//pull/218104, we incorrectly set the\noutput to be `Request failed to get to the server (status code: ' +\nstatusCode + ')` even if there is an error body. In this PR, we make\nsure to display the error body if it's non-empty.\n\n**How to test:**\n\nSend a request that fails and verify that the error body is displayed:\n\n```\nPOST kbn:/api/alerting/rule/3603c386-9102-4c74-800d-2242e52bec98\n{\n \"name\": \"Alert on status change\",\n \"rule_type_id\": \".es-querya\"\n}\n```\n<img width=\"1160\" alt=\"Screenshot 2025-04-24 at 14 41 57\"\nsrc=\"https://github.com/user-attachments/assets/ced78171-4924-477f-ba2f-d5812bff1678\"\n/>","sha":"cb0acc16ee85e4dccc67dcb69dbbba3f328accad"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Elena Stoeva <59341489+ElenaStoeva@users.noreply.github.com>
Follow-up to elastic#218104 (comment) ## Summary This PR fixes the Console output when the HTTP request to the server fails with a non-empty error body. In elastic#218104, we incorrectly set the output to be `Request failed to get to the server (status code: ' + statusCode + ')` even if there is an error body. In this PR, we make sure to display the error body if it's non-empty. **How to test:** Send a request that fails and verify that the error body is displayed: ``` POST kbn:/api/alerting/rule/3603c386-9102-4c74-800d-2242e52bec98 { "name": "Alert on status change", "rule_type_id": ".es-querya" } ``` <img width="1160" alt="Screenshot 2025-04-24 at 14 41 57" src="https://github.com/user-attachments/assets/ced78171-4924-477f-ba2f-d5812bff1678" /> (cherry picked from commit cb0acc1) # Conflicts: # src/platform/plugins/shared/console/public/application/hooks/use_send_current_request/send_request.ts
Follow-up to elastic#218104 (comment) ## Summary This PR fixes the Console output when the HTTP request to the server fails with a non-empty error body. In elastic#218104, we incorrectly set the output to be `Request failed to get to the server (status code: ' + statusCode + ')` even if there is an error body. In this PR, we make sure to display the error body if it's non-empty. **How to test:** Send a request that fails and verify that the error body is displayed: ``` POST kbn:/api/alerting/rule/3603c386-9102-4c74-800d-2242e52bec98 { "name": "Alert on status change", "rule_type_id": ".es-querya" } ``` <img width="1160" alt="Screenshot 2025-04-24 at 14 41 57" src="https://github.com/user-attachments/assets/ced78171-4924-477f-ba2f-d5812bff1678" /> (cherry picked from commit cb0acc1) # Conflicts: # src/platform/plugins/shared/console/public/application/hooks/use_send_current_request/send_request.ts
Follow-up to elastic#218104 (comment) This PR fixes the Console output when the HTTP request to the server fails with a non-empty error body. In elastic#218104, we incorrectly set the output to be `Request failed to get to the server (status code: ' + statusCode + ')` even if there is an error body. In this PR, we make sure to display the error body if it's non-empty. **How to test:** Send a request that fails and verify that the error body is displayed: ``` POST kbn:/api/alerting/rule/3603c386-9102-4c74-800d-2242e52bec98 { "name": "Alert on status change", "rule_type_id": ".es-querya" } ``` <img width="1160" alt="Screenshot 2025-04-24 at 14 41 57" src="https://github.com/user-attachments/assets/ced78171-4924-477f-ba2f-d5812bff1678" /> (cherry picked from commit cb0acc1)
#219439) # Backport This will backport the following commits from `main` to `9.0`: - [[Console] Fix output when HTTP request to server fails (#219073)](#219073) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Elena Stoeva","email":"59341489+ElenaStoeva@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-04-25T17:09:09Z","message":"[Console] Fix output when HTTP request to server fails (#219073)\n\nFollow-up to\nhttps://github.com//pull/218104#issuecomment-2824757130\n\n## Summary\n\nThis PR fixes the Console output when the HTTP request to the server\nfails with a non-empty error body. In\nhttps://github.com//pull/218104, we incorrectly set the\noutput to be `Request failed to get to the server (status code: ' +\nstatusCode + ')` even if there is an error body. In this PR, we make\nsure to display the error body if it's non-empty.\n\n**How to test:**\n\nSend a request that fails and verify that the error body is displayed:\n\n```\nPOST kbn:/api/alerting/rule/3603c386-9102-4c74-800d-2242e52bec98\n{\n \"name\": \"Alert on status change\",\n \"rule_type_id\": \".es-querya\"\n}\n```\n<img width=\"1160\" alt=\"Screenshot 2025-04-24 at 14 41 57\"\nsrc=\"https://github.com/user-attachments/assets/ced78171-4924-477f-ba2f-d5812bff1678\"\n/>","sha":"cb0acc16ee85e4dccc67dcb69dbbba3f328accad","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Console","Team:Kibana Management","release_note:skip","backport:prev-minor","v9.1.0","v8.19.0","v8.18.1","v9.0.1"],"title":"[Console] Fix output when HTTP request to server fails","number":219073,"url":"https://github.com/elastic/kibana/pull/219073","mergeCommit":{"message":"[Console] Fix output when HTTP request to server fails (#219073)\n\nFollow-up to\nhttps://github.com//pull/218104#issuecomment-2824757130\n\n## Summary\n\nThis PR fixes the Console output when the HTTP request to the server\nfails with a non-empty error body. In\nhttps://github.com//pull/218104, we incorrectly set the\noutput to be `Request failed to get to the server (status code: ' +\nstatusCode + ')` even if there is an error body. In this PR, we make\nsure to display the error body if it's non-empty.\n\n**How to test:**\n\nSend a request that fails and verify that the error body is displayed:\n\n```\nPOST kbn:/api/alerting/rule/3603c386-9102-4c74-800d-2242e52bec98\n{\n \"name\": \"Alert on status change\",\n \"rule_type_id\": \".es-querya\"\n}\n```\n<img width=\"1160\" alt=\"Screenshot 2025-04-24 at 14 41 57\"\nsrc=\"https://github.com/user-attachments/assets/ced78171-4924-477f-ba2f-d5812bff1678\"\n/>","sha":"cb0acc16ee85e4dccc67dcb69dbbba3f328accad"}},"sourceBranch":"main","suggestedTargetBranches":["8.18","9.0"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/219073","number":219073,"mergeCommit":{"message":"[Console] Fix output when HTTP request to server fails (#219073)\n\nFollow-up to\nhttps://github.com//pull/218104#issuecomment-2824757130\n\n## Summary\n\nThis PR fixes the Console output when the HTTP request to the server\nfails with a non-empty error body. In\nhttps://github.com//pull/218104, we incorrectly set the\noutput to be `Request failed to get to the server (status code: ' +\nstatusCode + ')` even if there is an error body. In this PR, we make\nsure to display the error body if it's non-empty.\n\n**How to test:**\n\nSend a request that fails and verify that the error body is displayed:\n\n```\nPOST kbn:/api/alerting/rule/3603c386-9102-4c74-800d-2242e52bec98\n{\n \"name\": \"Alert on status change\",\n \"rule_type_id\": \".es-querya\"\n}\n```\n<img width=\"1160\" alt=\"Screenshot 2025-04-24 at 14 41 57\"\nsrc=\"https://github.com/user-attachments/assets/ced78171-4924-477f-ba2f-d5812bff1678\"\n/>","sha":"cb0acc16ee85e4dccc67dcb69dbbba3f328accad"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/219295","number":219295,"state":"MERGED","mergeCommit":{"sha":"cd3c92728e0e6792a2dcf8a39b3d8bf71589c929","message":"[8.19] [Console] Fix output when HTTP request to server fails (#219073) (#219295)\n\n# Backport\n\nThis will backport the following commits from `main` to `8.19`:\n- [[Console] Fix output when HTTP request to server fails\n(#219073)](https://github.com/elastic/kibana/pull/219073)\n\n\n\n### Questions ?\nPlease refer to the [Backport tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by: Elena Stoeva <59341489+ElenaStoeva@users.noreply.github.com>"}},{"branch":"8.18","label":"v8.18.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT-->
… (#219440) # Backport This will backport the following commits from `main` to `8.18`: - [[Console] Fix output when HTTP request to server fails (#219073)](#219073) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Elena Stoeva","email":"59341489+ElenaStoeva@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-04-25T17:09:09Z","message":"[Console] Fix output when HTTP request to server fails (#219073)\n\nFollow-up to\nhttps://github.com//pull/218104#issuecomment-2824757130\n\n## Summary\n\nThis PR fixes the Console output when the HTTP request to the server\nfails with a non-empty error body. In\nhttps://github.com//pull/218104, we incorrectly set the\noutput to be `Request failed to get to the server (status code: ' +\nstatusCode + ')` even if there is an error body. In this PR, we make\nsure to display the error body if it's non-empty.\n\n**How to test:**\n\nSend a request that fails and verify that the error body is displayed:\n\n```\nPOST kbn:/api/alerting/rule/3603c386-9102-4c74-800d-2242e52bec98\n{\n \"name\": \"Alert on status change\",\n \"rule_type_id\": \".es-querya\"\n}\n```\n<img width=\"1160\" alt=\"Screenshot 2025-04-24 at 14 41 57\"\nsrc=\"https://github.com/user-attachments/assets/ced78171-4924-477f-ba2f-d5812bff1678\"\n/>","sha":"cb0acc16ee85e4dccc67dcb69dbbba3f328accad","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Console","Team:Kibana Management","release_note:skip","backport:prev-minor","v9.1.0","v8.19.0","v8.18.1","v9.0.1"],"title":"[Console] Fix output when HTTP request to server fails","number":219073,"url":"https://github.com/elastic/kibana/pull/219073","mergeCommit":{"message":"[Console] Fix output when HTTP request to server fails (#219073)\n\nFollow-up to\nhttps://github.com//pull/218104#issuecomment-2824757130\n\n## Summary\n\nThis PR fixes the Console output when the HTTP request to the server\nfails with a non-empty error body. In\nhttps://github.com//pull/218104, we incorrectly set the\noutput to be `Request failed to get to the server (status code: ' +\nstatusCode + ')` even if there is an error body. In this PR, we make\nsure to display the error body if it's non-empty.\n\n**How to test:**\n\nSend a request that fails and verify that the error body is displayed:\n\n```\nPOST kbn:/api/alerting/rule/3603c386-9102-4c74-800d-2242e52bec98\n{\n \"name\": \"Alert on status change\",\n \"rule_type_id\": \".es-querya\"\n}\n```\n<img width=\"1160\" alt=\"Screenshot 2025-04-24 at 14 41 57\"\nsrc=\"https://github.com/user-attachments/assets/ced78171-4924-477f-ba2f-d5812bff1678\"\n/>","sha":"cb0acc16ee85e4dccc67dcb69dbbba3f328accad"}},"sourceBranch":"main","suggestedTargetBranches":["8.18","9.0"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/219073","number":219073,"mergeCommit":{"message":"[Console] Fix output when HTTP request to server fails (#219073)\n\nFollow-up to\nhttps://github.com//pull/218104#issuecomment-2824757130\n\n## Summary\n\nThis PR fixes the Console output when the HTTP request to the server\nfails with a non-empty error body. In\nhttps://github.com//pull/218104, we incorrectly set the\noutput to be `Request failed to get to the server (status code: ' +\nstatusCode + ')` even if there is an error body. In this PR, we make\nsure to display the error body if it's non-empty.\n\n**How to test:**\n\nSend a request that fails and verify that the error body is displayed:\n\n```\nPOST kbn:/api/alerting/rule/3603c386-9102-4c74-800d-2242e52bec98\n{\n \"name\": \"Alert on status change\",\n \"rule_type_id\": \".es-querya\"\n}\n```\n<img width=\"1160\" alt=\"Screenshot 2025-04-24 at 14 41 57\"\nsrc=\"https://github.com/user-attachments/assets/ced78171-4924-477f-ba2f-d5812bff1678\"\n/>","sha":"cb0acc16ee85e4dccc67dcb69dbbba3f328accad"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/219295","number":219295,"state":"MERGED","mergeCommit":{"sha":"cd3c92728e0e6792a2dcf8a39b3d8bf71589c929","message":"[8.19] [Console] Fix output when HTTP request to server fails (#219073) (#219295)\n\n# Backport\n\nThis will backport the following commits from `main` to `8.19`:\n- [[Console] Fix output when HTTP request to server fails\n(#219073)](https://github.com/elastic/kibana/pull/219073)\n\n\n\n### Questions ?\nPlease refer to the [Backport tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by: Elena Stoeva <59341489+ElenaStoeva@users.noreply.github.com>"}},{"branch":"8.18","label":"v8.18.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT-->
Follow-up to elastic#218104 (comment) ## Summary This PR fixes the Console output when the HTTP request to the server fails with a non-empty error body. In elastic#218104, we incorrectly set the output to be `Request failed to get to the server (status code: ' + statusCode + ')` even if there is an error body. In this PR, we make sure to display the error body if it's non-empty. **How to test:** Send a request that fails and verify that the error body is displayed: ``` POST kbn:/api/alerting/rule/3603c386-9102-4c74-800d-2242e52bec98 { "name": "Alert on status change", "rule_type_id": ".es-querya" } ``` <img width="1160" alt="Screenshot 2025-04-24 at 14 41 57" src="https://github.com/user-attachments/assets/ced78171-4924-477f-ba2f-d5812bff1678" />

Fixes #217433
Summary
This PR fixes the Console output when the response body is an empty string.
In #199975, we made Console to display an
OKoutput if the status code is 200 but response body isnull. Previously,POST /_cluster/voting_config_exclusions?node_names=nodereturnednulland so the output was correctly set toOKbut now the response is an empty string and this case isn't covered correctly. In this PR, we make sure to perform the right check at the right point so that bothnulland empty strings are covered.The test that covers this scenario and had failures:
kibana/src/platform/test/functional/apps/console/_console.ts
Line 258 in 7092e79
To run the failing test with the new Es snapshots:
and