Skip to content

chore(axios,workflows-eng): remove axios from workflows connector utils#267512

Merged
azasypkin merged 1 commit intoelastic:mainfrom
azasypkin:issue-2244-remove-axios-phase-2
May 5, 2026
Merged

chore(axios,workflows-eng): remove axios from workflows connector utils#267512
azasypkin merged 1 commit intoelastic:mainfrom
azasypkin:issue-2244-remove-axios-phase-2

Conversation

@azasypkin
Copy link
Copy Markdown
Contributor

@azasypkin azasypkin commented May 4, 2026

Summary

This PR removes the axios dependency for files owned by @elastic/workflows-eng. Phase 2 of the axios migration tracked under #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 (#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.

@azasypkin azasypkin added chore release_note:skip Skip the PR/issue when compiling release notes dependencies Pull requests that update a dependency file backport:all-open Backport to all branches that could still receive a release labels May 4, 2026
@kibanamachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

✅ unchanged

@azasypkin azasypkin marked this pull request as ready for review May 4, 2026 15:19
@azasypkin azasypkin requested review from a team as code owners May 4, 2026 15:19
Copy link
Copy Markdown
Contributor

@dej611 dej611 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code review only

@botelastic botelastic Bot added the Team:One Workflow Team label for One Workflow (Workflow automation) label May 5, 2026
@azasypkin azasypkin merged commit 5f51f6c into elastic:main May 5, 2026
69 checks passed
@azasypkin azasypkin deleted the issue-2244-remove-axios-phase-2 branch May 5, 2026 08:05
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.19, 9.2, 9.3, 9.4

https://github.com/elastic/kibana/actions/runs/25364969810

@kibanamachine
Copy link
Copy Markdown
Contributor

💔 Some backports could not be created

Status Branch Result
8.19 Backport failed because of merge conflicts
9.2 Backport failed because of merge conflicts
9.3 Backport failed because of merge conflicts
9.4

Note: Successful backport PRs will be merged automatically after passing CI.

Manual backport

To create the backport manually run:

node scripts/backport --pr 267512

Questions ?

Please refer to the Backport tool documentation

mbondyra added a commit to mbondyra/kibana that referenced this pull request May 5, 2026
…ilder_new_vis_attachment

* commit '6fd683609eb6dee81f242f8ff6951edbe3bfd66c': (226 commits)
  Remove Model Author group-by option from external inference endpoints (elastic#264761)
  [Streams][Streamlang] Align ES|QL condition transpiler with Painless on null propagation (elastic#264751)
  chore(axios,workflows-eng): remove axios from workflows connector utils (elastic#267512)
  [failed-test-reporter] avoid opening issues for scout env failures (elastic#267649)
  [kbn-api-contracts] Detect request-body additionalProperties:false tightening (elastic#267546)
  [main] Sync bundled packages with Package Storage (elastic#267644)
  Centralize phase colors and descriptions (elastic#266680)
  [Unified Waterfall] Add "Scroll to origin" button  (elastic#266594)
  [APM] Add alert and SLO badges to the service map embeddable (elastic#266360)
  [CI] Speed up telemetry_check by pre-filtering to collector files (elastic#265978)
  [Discover] Address flaky large CSV test (elastic#266642)
  avoid passing unrelated props within integration card icon component conditional render (elastic#266569)
  [Cases][Templates] Extend cases search by template field label (elastic#266414)
  [Background search] Migrate custom SplitButton to EuiSplitButton (elastic#267447)
  [i18n] Report translation coverage during integrate (elastic#264124)
  [api-docs] 2026-05-05 Daily api_docs build (elastic#267639)
  [Scout] Update test config manifests (elastic#267636)
  [content list] Add saved object provider services (elastic#266428)
  [Fleet] Otel UI add health and implement it in OTelComponentDetail (elastic#267292)
  Update dependency msw to v2.13.4 (main) (elastic#266770)
  ...
kibanamachine added a commit that referenced this pull request May 5, 2026
…or utils (#267512) (#267665)

# Backport

This will backport the following commits from `main` to `9.4`:
- [chore(axios,workflows-eng): remove axios from workflows connector
utils (#267512)](#267512)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Aleh
Zasypkin","email":"aleh.zasypkin@elastic.co"},"sourceCommit":{"committedDate":"2026-05-05T08:05:42Z","message":"chore(axios,workflows-eng):
remove axios from workflows connector utils (#267512)\n\n##
Summary\n\nThis PR removes the `axios` dependency for files owned
by\n`@elastic/workflows-eng`. Phase 2 of the axios migration tracked
under\n#266556.\n\n### Why\n\nNode.js 22 ships a native `fetch` API
built on undici, and every browser\nKibana targets supports `fetch`
natively. Removing axios cuts one\nruntime dependency and continues the
per-team rollout that mirrors the\nearlier node-fetch
migration\n([#250719](#250719) and
siblings).\n\n###
Changes\n\n-\n`src/platform/plugins/shared/workflows_management/server/connectors/workflows/utils.ts`\npreviously
imported `isAxiosError` from `axios` to decide whether to\nextract
`error.response.data.message`. The production caller\n(`service.ts`)
feeds errors thrown by the injected workflow services,\nnever
AxiosError; the axios-specific branch was effectively dead\ndefensive
code. Replaced the type-guard with duck-typed access
to\n`response?.data?.message` so any HTTP-client error of similar
shape\nstill gets the upstream message extracted.\n- `utils.test.ts`
updated correspondingly: dropped the `AxiosError`\ntype-only import,
renamed mocks to `httpError`, added `name: 'Error'` so\n`as Error` casts
type-check. All 5 existing test cases still pass.\n- Removed the
`workflows_management/server/connectors/workflows/**`\nentry from
`AXIOS_LEGACY_CONSUMERS` in `.eslintrc.js`. New axios usage\nin this
directory is now blocked by the existing global ban. The
broader\n`workflows_management/**` override that bans `*legacy*` imports
still\napplies.\n\n### Behavior parity\n\nThe duck-typed access
preserves the exact extraction logic: when the\nerror has
`response.data.message`, that string is used; otherwise it\nfalls back
to `error.message`. All five test cases (HTTP error
with\n`data.message`, HTTP error with empty `data`, HTTP error
without\n`response`, regular `Error`, error without message) pass
without change\nto expected
output.","sha":"5f51f6c8463974089a6d781c56dcdb928557c52b","branchLabelMapping":{"^v9.5.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["chore","release_note:skip","dependencies","backport:all-open","Team:One
Workflow","v9.5.0"],"title":"chore(axios,workflows-eng): remove axios
from workflows connector
utils","number":267512,"url":"https://github.com/elastic/kibana/pull/267512","mergeCommit":{"message":"chore(axios,workflows-eng):
remove axios from workflows connector utils (#267512)\n\n##
Summary\n\nThis PR removes the `axios` dependency for files owned
by\n`@elastic/workflows-eng`. Phase 2 of the axios migration tracked
under\n#266556.\n\n### Why\n\nNode.js 22 ships a native `fetch` API
built on undici, and every browser\nKibana targets supports `fetch`
natively. Removing axios cuts one\nruntime dependency and continues the
per-team rollout that mirrors the\nearlier node-fetch
migration\n([#250719](#250719) and
siblings).\n\n###
Changes\n\n-\n`src/platform/plugins/shared/workflows_management/server/connectors/workflows/utils.ts`\npreviously
imported `isAxiosError` from `axios` to decide whether to\nextract
`error.response.data.message`. The production caller\n(`service.ts`)
feeds errors thrown by the injected workflow services,\nnever
AxiosError; the axios-specific branch was effectively dead\ndefensive
code. Replaced the type-guard with duck-typed access
to\n`response?.data?.message` so any HTTP-client error of similar
shape\nstill gets the upstream message extracted.\n- `utils.test.ts`
updated correspondingly: dropped the `AxiosError`\ntype-only import,
renamed mocks to `httpError`, added `name: 'Error'` so\n`as Error` casts
type-check. All 5 existing test cases still pass.\n- Removed the
`workflows_management/server/connectors/workflows/**`\nentry from
`AXIOS_LEGACY_CONSUMERS` in `.eslintrc.js`. New axios usage\nin this
directory is now blocked by the existing global ban. The
broader\n`workflows_management/**` override that bans `*legacy*` imports
still\napplies.\n\n### Behavior parity\n\nThe duck-typed access
preserves the exact extraction logic: when the\nerror has
`response.data.message`, that string is used; otherwise it\nfalls back
to `error.message`. All five test cases (HTTP error
with\n`data.message`, HTTP error with empty `data`, HTTP error
without\n`response`, regular `Error`, error without message) pass
without change\nto expected
output.","sha":"5f51f6c8463974089a6d781c56dcdb928557c52b"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.5.0","branchLabelMappingKey":"^v9.5.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/267512","number":267512,"mergeCommit":{"message":"chore(axios,workflows-eng):
remove axios from workflows connector utils (#267512)\n\n##
Summary\n\nThis PR removes the `axios` dependency for files owned
by\n`@elastic/workflows-eng`. Phase 2 of the axios migration tracked
under\n#266556.\n\n### Why\n\nNode.js 22 ships a native `fetch` API
built on undici, and every browser\nKibana targets supports `fetch`
natively. Removing axios cuts one\nruntime dependency and continues the
per-team rollout that mirrors the\nearlier node-fetch
migration\n([#250719](#250719) and
siblings).\n\n###
Changes\n\n-\n`src/platform/plugins/shared/workflows_management/server/connectors/workflows/utils.ts`\npreviously
imported `isAxiosError` from `axios` to decide whether to\nextract
`error.response.data.message`. The production caller\n(`service.ts`)
feeds errors thrown by the injected workflow services,\nnever
AxiosError; the axios-specific branch was effectively dead\ndefensive
code. Replaced the type-guard with duck-typed access
to\n`response?.data?.message` so any HTTP-client error of similar
shape\nstill gets the upstream message extracted.\n- `utils.test.ts`
updated correspondingly: dropped the `AxiosError`\ntype-only import,
renamed mocks to `httpError`, added `name: 'Error'` so\n`as Error` casts
type-check. All 5 existing test cases still pass.\n- Removed the
`workflows_management/server/connectors/workflows/**`\nentry from
`AXIOS_LEGACY_CONSUMERS` in `.eslintrc.js`. New axios usage\nin this
directory is now blocked by the existing global ban. The
broader\n`workflows_management/**` override that bans `*legacy*` imports
still\napplies.\n\n### Behavior parity\n\nThe duck-typed access
preserves the exact extraction logic: when the\nerror has
`response.data.message`, that string is used; otherwise it\nfalls back
to `error.message`. All five test cases (HTTP error
with\n`data.message`, HTTP error with empty `data`, HTTP error
without\n`response`, regular `Error`, error without message) pass
without change\nto expected
output.","sha":"5f51f6c8463974089a6d781c56dcdb928557c52b"}}]}]
BACKPORT-->

Co-authored-by: Aleh Zasypkin <aleh.zasypkin@elastic.co>
@azasypkin
Copy link
Copy Markdown
Contributor Author

💔 Some backports could not be created

Status Branch Result
9.3
9.2
8.19 An unhandled error occurred. Please see the logs for details

Note: Successful backport PRs will be merged automatically after passing CI.

Manual backport

To create the backport manually run:

node scripts/backport --pr 267512

Questions ?

Please refer to the Backport tool documentation

@azasypkin azasypkin added backport:version Backport to applied version labels v9.2.9 v9.3.5 and removed backport:all-open Backport to all branches that could still receive a release labels May 5, 2026
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 9.2, 9.3, 9.4

https://github.com/elastic/kibana/actions/runs/25370218494

@azasypkin
Copy link
Copy Markdown
Contributor Author

❌ 8.19 An unhandled error occurred. Please see the logs for details

Cancelled this one - there is no workflow stuff in 8.19.

@kibanamachine
Copy link
Copy Markdown
Contributor

💔 All backports failed

Status Branch Result
9.2 Backport failed because of merge conflicts
9.3 Backport failed because of merge conflicts
9.4 Cherrypick failed because the selected commit (5f51f6c) is empty. It looks like the commit was already backported in #267665

Manual backport

To create the backport manually run:

node scripts/backport --pr 267512

Questions ?

Please refer to the Backport tool documentation

@azasypkin azasypkin self-assigned this May 5, 2026
azasypkin added a commit that referenced this pull request May 6, 2026
…or utils (#267512) (#267681)

# Backport

This will backport the following commits from `main` to `9.2`:
- [chore(axios,workflows-eng): remove axios from workflows connector
utils (#267512)](#267512)

<!--- Backport version: 11.0.2 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Aleh
Zasypkin","email":"aleh.zasypkin@elastic.co"},"sourceCommit":{"committedDate":"2026-05-05T08:05:42Z","message":"chore(axios,workflows-eng):
remove axios from workflows connector utils (#267512)\n\n##
Summary\n\nThis PR removes the `axios` dependency for files owned
by\n`@elastic/workflows-eng`. Phase 2 of the axios migration tracked
under\n#266556.\n\n### Why\n\nNode.js 22 ships a native `fetch` API
built on undici, and every browser\nKibana targets supports `fetch`
natively. Removing axios cuts one\nruntime dependency and continues the
per-team rollout that mirrors the\nearlier node-fetch
migration\n([#250719](#250719) and
siblings).\n\n###
Changes\n\n-\n`src/platform/plugins/shared/workflows_management/server/connectors/workflows/utils.ts`\npreviously
imported `isAxiosError` from `axios` to decide whether to\nextract
`error.response.data.message`. The production caller\n(`service.ts`)
feeds errors thrown by the injected workflow services,\nnever
AxiosError; the axios-specific branch was effectively dead\ndefensive
code. Replaced the type-guard with duck-typed access
to\n`response?.data?.message` so any HTTP-client error of similar
shape\nstill gets the upstream message extracted.\n- `utils.test.ts`
updated correspondingly: dropped the `AxiosError`\ntype-only import,
renamed mocks to `httpError`, added `name: 'Error'` so\n`as Error` casts
type-check. All 5 existing test cases still pass.\n- Removed the
`workflows_management/server/connectors/workflows/**`\nentry from
`AXIOS_LEGACY_CONSUMERS` in `.eslintrc.js`. New axios usage\nin this
directory is now blocked by the existing global ban. The
broader\n`workflows_management/**` override that bans `*legacy*` imports
still\napplies.\n\n### Behavior parity\n\nThe duck-typed access
preserves the exact extraction logic: when the\nerror has
`response.data.message`, that string is used; otherwise it\nfalls back
to `error.message`. All five test cases (HTTP error
with\n`data.message`, HTTP error with empty `data`, HTTP error
without\n`response`, regular `Error`, error without message) pass
without change\nto expected
output.","sha":"5f51f6c8463974089a6d781c56dcdb928557c52b","branchLabelMapping":{"^v9.5.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["chore","release_note:skip","dependencies","backport:all-open","Team:One
Workflow","v9.4.0","v9.5.0"],"title":"chore(axios,workflows-eng): remove
axios from workflows connector
utils","number":267512,"url":"https://github.com/elastic/kibana/pull/267512","mergeCommit":{"message":"chore(axios,workflows-eng):
remove axios from workflows connector utils (#267512)\n\n##
Summary\n\nThis PR removes the `axios` dependency for files owned
by\n`@elastic/workflows-eng`. Phase 2 of the axios migration tracked
under\n#266556.\n\n### Why\n\nNode.js 22 ships a native `fetch` API
built on undici, and every browser\nKibana targets supports `fetch`
natively. Removing axios cuts one\nruntime dependency and continues the
per-team rollout that mirrors the\nearlier node-fetch
migration\n([#250719](#250719) and
siblings).\n\n###
Changes\n\n-\n`src/platform/plugins/shared/workflows_management/server/connectors/workflows/utils.ts`\npreviously
imported `isAxiosError` from `axios` to decide whether to\nextract
`error.response.data.message`. The production caller\n(`service.ts`)
feeds errors thrown by the injected workflow services,\nnever
AxiosError; the axios-specific branch was effectively dead\ndefensive
code. Replaced the type-guard with duck-typed access
to\n`response?.data?.message` so any HTTP-client error of similar
shape\nstill gets the upstream message extracted.\n- `utils.test.ts`
updated correspondingly: dropped the `AxiosError`\ntype-only import,
renamed mocks to `httpError`, added `name: 'Error'` so\n`as Error` casts
type-check. All 5 existing test cases still pass.\n- Removed the
`workflows_management/server/connectors/workflows/**`\nentry from
`AXIOS_LEGACY_CONSUMERS` in `.eslintrc.js`. New axios usage\nin this
directory is now blocked by the existing global ban. The
broader\n`workflows_management/**` override that bans `*legacy*` imports
still\napplies.\n\n### Behavior parity\n\nThe duck-typed access
preserves the exact extraction logic: when the\nerror has
`response.data.message`, that string is used; otherwise it\nfalls back
to `error.message`. All five test cases (HTTP error
with\n`data.message`, HTTP error with empty `data`, HTTP error
without\n`response`, regular `Error`, error without message) pass
without change\nto expected
output.","sha":"5f51f6c8463974089a6d781c56dcdb928557c52b"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"9.4","label":"v9.4.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/267665","number":267665,"state":"MERGED","mergeCommit":{"sha":"de5f2b8ecdfd4db23cafcabe81d376f0b54f251f","message":"[9.4]
chore(axios,workflows-eng): remove axios from workflows connector utils
(#267512) (#267665)\n\n# Backport\n\nThis will backport the following
commits from `main` to `9.4`:\n- [chore(axios,workflows-eng): remove
axios from workflows connector\nutils
(#267512)](https://github.com/elastic/kibana/pull/267512)\n\n\n\n###
Questions ?\nPlease refer to the [Backport
tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by:
Aleh Zasypkin
<aleh.zasypkin@elastic.co>"}},{"branch":"main","label":"v9.5.0","branchLabelMappingKey":"^v9.5.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/267512","number":267512,"mergeCommit":{"message":"chore(axios,workflows-eng):
remove axios from workflows connector utils (#267512)\n\n##
Summary\n\nThis PR removes the `axios` dependency for files owned
by\n`@elastic/workflows-eng`. Phase 2 of the axios migration tracked
under\n#266556.\n\n### Why\n\nNode.js 22 ships a native `fetch` API
built on undici, and every browser\nKibana targets supports `fetch`
natively. Removing axios cuts one\nruntime dependency and continues the
per-team rollout that mirrors the\nearlier node-fetch
migration\n([#250719](#250719) and
siblings).\n\n###
Changes\n\n-\n`src/platform/plugins/shared/workflows_management/server/connectors/workflows/utils.ts`\npreviously
imported `isAxiosError` from `axios` to decide whether to\nextract
`error.response.data.message`. The production caller\n(`service.ts`)
feeds errors thrown by the injected workflow services,\nnever
AxiosError; the axios-specific branch was effectively dead\ndefensive
code. Replaced the type-guard with duck-typed access
to\n`response?.data?.message` so any HTTP-client error of similar
shape\nstill gets the upstream message extracted.\n- `utils.test.ts`
updated correspondingly: dropped the `AxiosError`\ntype-only import,
renamed mocks to `httpError`, added `name: 'Error'` so\n`as Error` casts
type-check. All 5 existing test cases still pass.\n- Removed the
`workflows_management/server/connectors/workflows/**`\nentry from
`AXIOS_LEGACY_CONSUMERS` in `.eslintrc.js`. New axios usage\nin this
directory is now blocked by the existing global ban. The
broader\n`workflows_management/**` override that bans `*legacy*` imports
still\napplies.\n\n### Behavior parity\n\nThe duck-typed access
preserves the exact extraction logic: when the\nerror has
`response.data.message`, that string is used; otherwise it\nfalls back
to `error.message`. All five test cases (HTTP error
with\n`data.message`, HTTP error with empty `data`, HTTP error
without\n`response`, regular `Error`, error without message) pass
without change\nto expected
output.","sha":"5f51f6c8463974089a6d781c56dcdb928557c52b"}}]}]
BACKPORT-->
azasypkin added a commit that referenced this pull request May 6, 2026
…or utils (#267512) (#267679)

# Backport

This will backport the following commits from `main` to `9.3`:
- [chore(axios,workflows-eng): remove axios from workflows connector
utils (#267512)](#267512)

<!--- Backport version: 11.0.2 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Aleh
Zasypkin","email":"aleh.zasypkin@elastic.co"},"sourceCommit":{"committedDate":"2026-05-05T08:05:42Z","message":"chore(axios,workflows-eng):
remove axios from workflows connector utils (#267512)\n\n##
Summary\n\nThis PR removes the `axios` dependency for files owned
by\n`@elastic/workflows-eng`. Phase 2 of the axios migration tracked
under\n#266556.\n\n### Why\n\nNode.js 22 ships a native `fetch` API
built on undici, and every browser\nKibana targets supports `fetch`
natively. Removing axios cuts one\nruntime dependency and continues the
per-team rollout that mirrors the\nearlier node-fetch
migration\n([#250719](#250719) and
siblings).\n\n###
Changes\n\n-\n`src/platform/plugins/shared/workflows_management/server/connectors/workflows/utils.ts`\npreviously
imported `isAxiosError` from `axios` to decide whether to\nextract
`error.response.data.message`. The production caller\n(`service.ts`)
feeds errors thrown by the injected workflow services,\nnever
AxiosError; the axios-specific branch was effectively dead\ndefensive
code. Replaced the type-guard with duck-typed access
to\n`response?.data?.message` so any HTTP-client error of similar
shape\nstill gets the upstream message extracted.\n- `utils.test.ts`
updated correspondingly: dropped the `AxiosError`\ntype-only import,
renamed mocks to `httpError`, added `name: 'Error'` so\n`as Error` casts
type-check. All 5 existing test cases still pass.\n- Removed the
`workflows_management/server/connectors/workflows/**`\nentry from
`AXIOS_LEGACY_CONSUMERS` in `.eslintrc.js`. New axios usage\nin this
directory is now blocked by the existing global ban. The
broader\n`workflows_management/**` override that bans `*legacy*` imports
still\napplies.\n\n### Behavior parity\n\nThe duck-typed access
preserves the exact extraction logic: when the\nerror has
`response.data.message`, that string is used; otherwise it\nfalls back
to `error.message`. All five test cases (HTTP error
with\n`data.message`, HTTP error with empty `data`, HTTP error
without\n`response`, regular `Error`, error without message) pass
without change\nto expected
output.","sha":"5f51f6c8463974089a6d781c56dcdb928557c52b","branchLabelMapping":{"^v9.5.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["chore","release_note:skip","dependencies","backport:all-open","Team:One
Workflow","v9.4.0","v9.5.0"],"title":"chore(axios,workflows-eng): remove
axios from workflows connector
utils","number":267512,"url":"https://github.com/elastic/kibana/pull/267512","mergeCommit":{"message":"chore(axios,workflows-eng):
remove axios from workflows connector utils (#267512)\n\n##
Summary\n\nThis PR removes the `axios` dependency for files owned
by\n`@elastic/workflows-eng`. Phase 2 of the axios migration tracked
under\n#266556.\n\n### Why\n\nNode.js 22 ships a native `fetch` API
built on undici, and every browser\nKibana targets supports `fetch`
natively. Removing axios cuts one\nruntime dependency and continues the
per-team rollout that mirrors the\nearlier node-fetch
migration\n([#250719](#250719) and
siblings).\n\n###
Changes\n\n-\n`src/platform/plugins/shared/workflows_management/server/connectors/workflows/utils.ts`\npreviously
imported `isAxiosError` from `axios` to decide whether to\nextract
`error.response.data.message`. The production caller\n(`service.ts`)
feeds errors thrown by the injected workflow services,\nnever
AxiosError; the axios-specific branch was effectively dead\ndefensive
code. Replaced the type-guard with duck-typed access
to\n`response?.data?.message` so any HTTP-client error of similar
shape\nstill gets the upstream message extracted.\n- `utils.test.ts`
updated correspondingly: dropped the `AxiosError`\ntype-only import,
renamed mocks to `httpError`, added `name: 'Error'` so\n`as Error` casts
type-check. All 5 existing test cases still pass.\n- Removed the
`workflows_management/server/connectors/workflows/**`\nentry from
`AXIOS_LEGACY_CONSUMERS` in `.eslintrc.js`. New axios usage\nin this
directory is now blocked by the existing global ban. The
broader\n`workflows_management/**` override that bans `*legacy*` imports
still\napplies.\n\n### Behavior parity\n\nThe duck-typed access
preserves the exact extraction logic: when the\nerror has
`response.data.message`, that string is used; otherwise it\nfalls back
to `error.message`. All five test cases (HTTP error
with\n`data.message`, HTTP error with empty `data`, HTTP error
without\n`response`, regular `Error`, error without message) pass
without change\nto expected
output.","sha":"5f51f6c8463974089a6d781c56dcdb928557c52b"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"9.4","label":"v9.4.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/267665","number":267665,"state":"MERGED","mergeCommit":{"sha":"de5f2b8ecdfd4db23cafcabe81d376f0b54f251f","message":"[9.4]
chore(axios,workflows-eng): remove axios from workflows connector utils
(#267512) (#267665)\n\n# Backport\n\nThis will backport the following
commits from `main` to `9.4`:\n- [chore(axios,workflows-eng): remove
axios from workflows connector\nutils
(#267512)](https://github.com/elastic/kibana/pull/267512)\n\n\n\n###
Questions ?\nPlease refer to the [Backport
tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by:
Aleh Zasypkin
<aleh.zasypkin@elastic.co>"}},{"branch":"main","label":"v9.5.0","branchLabelMappingKey":"^v9.5.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/267512","number":267512,"mergeCommit":{"message":"chore(axios,workflows-eng):
remove axios from workflows connector utils (#267512)\n\n##
Summary\n\nThis PR removes the `axios` dependency for files owned
by\n`@elastic/workflows-eng`. Phase 2 of the axios migration tracked
under\n#266556.\n\n### Why\n\nNode.js 22 ships a native `fetch` API
built on undici, and every browser\nKibana targets supports `fetch`
natively. Removing axios cuts one\nruntime dependency and continues the
per-team rollout that mirrors the\nearlier node-fetch
migration\n([#250719](#250719) and
siblings).\n\n###
Changes\n\n-\n`src/platform/plugins/shared/workflows_management/server/connectors/workflows/utils.ts`\npreviously
imported `isAxiosError` from `axios` to decide whether to\nextract
`error.response.data.message`. The production caller\n(`service.ts`)
feeds errors thrown by the injected workflow services,\nnever
AxiosError; the axios-specific branch was effectively dead\ndefensive
code. Replaced the type-guard with duck-typed access
to\n`response?.data?.message` so any HTTP-client error of similar
shape\nstill gets the upstream message extracted.\n- `utils.test.ts`
updated correspondingly: dropped the `AxiosError`\ntype-only import,
renamed mocks to `httpError`, added `name: 'Error'` so\n`as Error` casts
type-check. All 5 existing test cases still pass.\n- Removed the
`workflows_management/server/connectors/workflows/**`\nentry from
`AXIOS_LEGACY_CONSUMERS` in `.eslintrc.js`. New axios usage\nin this
directory is now blocked by the existing global ban. The
broader\n`workflows_management/**` override that bans `*legacy*` imports
still\napplies.\n\n### Behavior parity\n\nThe duck-typed access
preserves the exact extraction logic: when the\nerror has
`response.data.message`, that string is used; otherwise it\nfalls back
to `error.message`. All five test cases (HTTP error
with\n`data.message`, HTTP error with empty `data`, HTTP error
without\n`response`, regular `Error`, error without message) pass
without change\nto expected
output.","sha":"5f51f6c8463974089a6d781c56dcdb928557c52b"}}]}]
BACKPORT-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels chore dependencies Pull requests that update a dependency file release_note:skip Skip the PR/issue when compiling release notes Team:One Workflow Team label for One Workflow (Workflow automation) v9.2.9 v9.3.5 v9.4.0 v9.5.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants