[Osquery] Fix pack and saved query APIs returning 500 instead of 404 for "not found" errors#258883
Conversation
…r missing resources
| ).to.be(singleLineQuery); | ||
| }); | ||
|
|
||
| describe('404 for non-existent resources', () => { |
There was a problem hiding this comment.
Making sure these changes have coverage (they previously didn't). While it's true that some (if not all) of these tests will be replaced by Scout, let's ensure these changes are correct right away. These new FTR tests are passing locally.
tomsonpl
left a comment
There was a problem hiding this comment.
Thank you for fixing the issue :) Really appreciate the help! :)
I left a comment, I believe it's crucial to be addressed before merging this PR.
x-pack/platform/plugins/shared/osquery/server/routes/pack/read_pack_route.ts
Show resolved
Hide resolved
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]
History
cc @csr |
tomsonpl
left a comment
There was a problem hiding this comment.
Thanks for addressing the issue, LGTM 👍
|
Starting backport for target branches: 8.19, 9.2, 9.3 https://github.com/elastic/kibana/actions/runs/23447332485 |
💔 All backports failed
Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
…for "not found" errors (#258883) I noticed while working on Scout API tests (#258534) that the GET endpoints for packs and saved queries return a `500` Internal Server Error when the resource doesn't exist, rather than the usual `404`. This PR fixes it. Worth mentioning that the issue occurs in all surfaces (stateful deployment, ECH, MKI). Some FTR API integration tests were added to ensure coverage.
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
2 similar comments
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
…for "not found" errors (elastic#258883) I noticed while working on Scout API tests (elastic#258534) that the GET endpoints for packs and saved queries return a `500` Internal Server Error when the resource doesn't exist, rather than the usual `404`. This PR fixes it. Worth mentioning that the issue occurs in all surfaces (stateful deployment, ECH, MKI). Some FTR API integration tests were added to ensure coverage. (cherry picked from commit 4301849) # Conflicts: # x-pack/platform/plugins/shared/osquery/server/routes/pack/delete_pack_route.ts # x-pack/platform/plugins/shared/osquery/server/routes/pack/update_pack_route.ts # x-pack/platform/plugins/shared/osquery/server/routes/saved_query/update_saved_query_route.ts # x-pack/platform/test/api_integration/apis/osquery/saved_queries.ts
…for "not found" errors (elastic#258883) I noticed while working on Scout API tests (elastic#258534) that the GET endpoints for packs and saved queries return a `500` Internal Server Error when the resource doesn't exist, rather than the usual `404`. This PR fixes it. Worth mentioning that the issue occurs in all surfaces (stateful deployment, ECH, MKI). Some FTR API integration tests were added to ensure coverage.
…for "not found" errors (elastic#258883) I noticed while working on Scout API tests (elastic#258534) that the GET endpoints for packs and saved queries return a `500` Internal Server Error when the resource doesn't exist, rather than the usual `404`. This PR fixes it. Worth mentioning that the issue occurs in all surfaces (stateful deployment, ECH, MKI). Some FTR API integration tests were added to ensure coverage. (cherry picked from commit 4301849)
…for "not found" errors (elastic#258883) I noticed while working on Scout API tests (elastic#258534) that the GET endpoints for packs and saved queries return a `500` Internal Server Error when the resource doesn't exist, rather than the usual `404`. This PR fixes it. Worth mentioning that the issue occurs in all surfaces (stateful deployment, ECH, MKI). Some FTR API integration tests were added to ensure coverage. (cherry picked from commit 4301849)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
|
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. |
1 similar comment
|
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. |
…f 404 for "not found" errors (#258883) (#259703) # Backport This will backport the following commits from `main` to `9.2`: - [[Osquery] Fix pack and saved query APIs returning 500 instead of 404 for "not found" errors (#258883)](#258883) <!--- Backport version: 11.0.1 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Cesare de Cal","email":"cesare.decal@elastic.co"},"sourceCommit":{"committedDate":"2026-03-23T16:09:12Z","message":"[Osquery] Fix pack and saved query APIs returning 500 instead of 404 for \"not found\" errors (#258883)\n\nI noticed while working on Scout API tests\n(#258534) that the GET endpoints\nfor packs and saved queries return a `500` Internal Server Error when\nthe resource doesn't exist, rather than the usual `404`. This PR fixes\nit. Worth mentioning that the issue occurs in all surfaces (stateful\ndeployment, ECH, MKI). Some FTR API integration tests were added to\nensure coverage.","sha":"4301849b361347096590df70c0229d63f63dc932","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport missing","backport:all-open","v9.4.0"],"title":"[Osquery] Fix pack and saved query APIs returning 500 instead of 404 for \"not found\" errors","number":258883,"url":"https://github.com/elastic/kibana/pull/258883","mergeCommit":{"message":"[Osquery] Fix pack and saved query APIs returning 500 instead of 404 for \"not found\" errors (#258883)\n\nI noticed while working on Scout API tests\n(#258534) that the GET endpoints\nfor packs and saved queries return a `500` Internal Server Error when\nthe resource doesn't exist, rather than the usual `404`. This PR fixes\nit. Worth mentioning that the issue occurs in all surfaces (stateful\ndeployment, ECH, MKI). Some FTR API integration tests were added to\nensure coverage.","sha":"4301849b361347096590df70c0229d63f63dc932"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/258883","number":258883,"mergeCommit":{"message":"[Osquery] Fix pack and saved query APIs returning 500 instead of 404 for \"not found\" errors (#258883)\n\nI noticed while working on Scout API tests\n(#258534) that the GET endpoints\nfor packs and saved queries return a `500` Internal Server Error when\nthe resource doesn't exist, rather than the usual `404`. This PR fixes\nit. Worth mentioning that the issue occurs in all surfaces (stateful\ndeployment, ECH, MKI). Some FTR API integration tests were added to\nensure coverage.","sha":"4301849b361347096590df70c0229d63f63dc932"}}]}] BACKPORT-->
|
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. |
…of 404 for "not found" errors (#258883) (#259704) # Backport This will backport the following commits from `main` to `8.19`: - [[Osquery] Fix pack and saved query APIs returning 500 instead of 404 for "not found" errors (#258883)](#258883) <!--- Backport version: 11.0.1 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Cesare de Cal","email":"cesare.decal@elastic.co"},"sourceCommit":{"committedDate":"2026-03-23T16:09:12Z","message":"[Osquery] Fix pack and saved query APIs returning 500 instead of 404 for \"not found\" errors (#258883)\n\nI noticed while working on Scout API tests\n(#258534) that the GET endpoints\nfor packs and saved queries return a `500` Internal Server Error when\nthe resource doesn't exist, rather than the usual `404`. This PR fixes\nit. Worth mentioning that the issue occurs in all surfaces (stateful\ndeployment, ECH, MKI). Some FTR API integration tests were added to\nensure coverage.","sha":"4301849b361347096590df70c0229d63f63dc932","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport missing","backport:all-open","v9.4.0"],"title":"[Osquery] Fix pack and saved query APIs returning 500 instead of 404 for \"not found\" errors","number":258883,"url":"https://github.com/elastic/kibana/pull/258883","mergeCommit":{"message":"[Osquery] Fix pack and saved query APIs returning 500 instead of 404 for \"not found\" errors (#258883)\n\nI noticed while working on Scout API tests\n(#258534) that the GET endpoints\nfor packs and saved queries return a `500` Internal Server Error when\nthe resource doesn't exist, rather than the usual `404`. This PR fixes\nit. Worth mentioning that the issue occurs in all surfaces (stateful\ndeployment, ECH, MKI). Some FTR API integration tests were added to\nensure coverage.","sha":"4301849b361347096590df70c0229d63f63dc932"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/258883","number":258883,"mergeCommit":{"message":"[Osquery] Fix pack and saved query APIs returning 500 instead of 404 for \"not found\" errors (#258883)\n\nI noticed while working on Scout API tests\n(#258534) that the GET endpoints\nfor packs and saved queries return a `500` Internal Server Error when\nthe resource doesn't exist, rather than the usual `404`. This PR fixes\nit. Worth mentioning that the issue occurs in all surfaces (stateful\ndeployment, ECH, MKI). Some FTR API integration tests were added to\nensure coverage.","sha":"4301849b361347096590df70c0229d63f63dc932"}}]}] BACKPORT-->
…f 404 for "not found" errors (#258883) (#259702) # Backport This will backport the following commits from `main` to `9.3`: - [[Osquery] Fix pack and saved query APIs returning 500 instead of 404 for "not found" errors (#258883)](#258883) <!--- Backport version: 11.0.1 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Cesare de Cal","email":"cesare.decal@elastic.co"},"sourceCommit":{"committedDate":"2026-03-23T16:09:12Z","message":"[Osquery] Fix pack and saved query APIs returning 500 instead of 404 for \"not found\" errors (#258883)\n\nI noticed while working on Scout API tests\n(#258534) that the GET endpoints\nfor packs and saved queries return a `500` Internal Server Error when\nthe resource doesn't exist, rather than the usual `404`. This PR fixes\nit. Worth mentioning that the issue occurs in all surfaces (stateful\ndeployment, ECH, MKI). Some FTR API integration tests were added to\nensure coverage.","sha":"4301849b361347096590df70c0229d63f63dc932","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport missing","backport:all-open","v9.4.0"],"title":"[Osquery] Fix pack and saved query APIs returning 500 instead of 404 for \"not found\" errors","number":258883,"url":"https://github.com/elastic/kibana/pull/258883","mergeCommit":{"message":"[Osquery] Fix pack and saved query APIs returning 500 instead of 404 for \"not found\" errors (#258883)\n\nI noticed while working on Scout API tests\n(#258534) that the GET endpoints\nfor packs and saved queries return a `500` Internal Server Error when\nthe resource doesn't exist, rather than the usual `404`. This PR fixes\nit. Worth mentioning that the issue occurs in all surfaces (stateful\ndeployment, ECH, MKI). Some FTR API integration tests were added to\nensure coverage.","sha":"4301849b361347096590df70c0229d63f63dc932"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/258883","number":258883,"mergeCommit":{"message":"[Osquery] Fix pack and saved query APIs returning 500 instead of 404 for \"not found\" errors (#258883)\n\nI noticed while working on Scout API tests\n(#258534) that the GET endpoints\nfor packs and saved queries return a `500` Internal Server Error when\nthe resource doesn't exist, rather than the usual `404`. This PR fixes\nit. Worth mentioning that the issue occurs in all surfaces (stateful\ndeployment, ECH, MKI). Some FTR API integration tests were added to\nensure coverage.","sha":"4301849b361347096590df70c0229d63f63dc932"}}]}] BACKPORT-->
I noticed while working on Scout API tests (#258534) that the GET endpoints for packs and saved queries return a
500Internal Server Error when the resource doesn't exist, rather than the usual404. This PR fixes it. Worth mentioning that the issue occurs in all surfaces (stateful deployment, ECH, MKI). Some FTR API integration tests were added to ensure coverage.