[9.2] chore(axios,workflows-eng): remove axios from workflows connector utils (#267512)#267681
Merged
azasypkin merged 1 commit intoelastic:9.2from May 6, 2026
Merged
Conversation
…ls (elastic#267512) ## Summary This PR removes the `axios` dependency for files owned by `@elastic/workflows-eng`. Phase 2 of the axios migration tracked under elastic#266556. ### Why Node.js 22 ships a native `fetch` API built on undici, and every browser Kibana targets supports `fetch` natively. Removing axios cuts one runtime dependency and continues the per-team rollout that mirrors the earlier node-fetch migration ([elastic#250719](elastic#250719) and siblings). ### Changes - `src/platform/plugins/shared/workflows_management/server/connectors/workflows/utils.ts` previously imported `isAxiosError` from `axios` to decide whether to extract `error.response.data.message`. The production caller (`service.ts`) feeds errors thrown by the injected workflow services, never AxiosError; the axios-specific branch was effectively dead defensive code. Replaced the type-guard with duck-typed access to `response?.data?.message` so any HTTP-client error of similar shape still gets the upstream message extracted. - `utils.test.ts` updated correspondingly: dropped the `AxiosError` type-only import, renamed mocks to `httpError`, added `name: 'Error'` so `as Error` casts type-check. All 5 existing test cases still pass. - Removed the `workflows_management/server/connectors/workflows/**` entry from `AXIOS_LEGACY_CONSUMERS` in `.eslintrc.js`. New axios usage in this directory is now blocked by the existing global ban. The broader `workflows_management/**` override that bans `*legacy*` imports still applies. ### Behavior parity The duck-typed access preserves the exact extraction logic: when the error has `response.data.message`, that string is used; otherwise it falls back to `error.message`. All five test cases (HTTP error with `data.message`, HTTP error with empty `data`, HTTP error without `response`, regular `Error`, error without message) pass without change to expected output. # Conflicts: # .eslintrc.js
Contributor
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]
|
elena-shostak
approved these changes
May 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport
This will backport the following commits from
mainto9.2:Questions ?
Please refer to the Backport tool documentation