Skip to content

chore(axios,security-engineering-productivity): remove axios from run_cypress scripts#267684

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

chore(axios,security-engineering-productivity): remove axios from run_cypress scripts#267684
azasypkin merged 1 commit intoelastic:mainfrom
azasypkin:issue-2244-remove-axios-phase-3

Conversation

@azasypkin
Copy link
Copy Markdown
Contributor

@azasypkin azasypkin commented May 5, 2026

Summary

NOTE TO CODE OWNERS: I'm modifying code I don't own day to day. Please verify the changes still work as expected - for these migrations a quick run of the affected scripts/tests is worth more than a code-only review.

This PR removes the axios dependency for files owned by @elastic/security-engineering-productivity. Phase 3 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

Three files under x-pack/solutions/security/plugins/security_solution/scripts/run_cypress/, all developer/CI scripts that spin up serverless test projects and poll their readiness:

  • parallel_serverless.ts - 5 axios calls (proxy healthcheck, ES _cluster/health, Kibana /api/status, ES root, Kibana login). Replaced with fetch + explicit res.ok check + typed await res.json(). Dropped the .catch(catchAxiosErrorFormatAndThrow) wrappers that wrapped AxiosError into FormattedAxiosError; replaced with inline throw new Error('${response.status}:${await response.text()}') that preserves status+body in the error message. Folded 'Content-Type': 'application/json' into the module-private API_HEADERS constant and unwrapped [ELASTIC_HTTP_VERSION_HEADER]: [INITIAL_REST_VERSION] to a bare string - axios was setting Content-Type implicitly for object bodies and silently joining the single-element array, neither of which fetch does.
  • cloud_project_handler.ts - 4 axios calls (create project, delete project, reset credentials, status poll).
  • proxy_project_handler.ts - same shape as cloud_project_handler.ts with proxy-specific URLs.

Both project_handler files: catch blocks previously had an if (error instanceof AxiosError) { log status:data } else { log message } branch; with fetch the AxiosError branch is now dead, so they collapse to a single this.log.error(${error.message}). The thrown error's message contains ${status}:${responseBody} to preserve the same diagnostic content.

The retry callbacks' error instanceof AxiosError && error.code === 'ENOTFOUND' checks (used to log a friendlier "URL not yet reachable" message during DNS failures) were replaced with (error as { cause?: { code?: string } }).cause?.code === 'ENOTFOUND' — Node fetch wraps the underlying network error on error.cause, so DNS failures still surface with cause.code === 'ENOTFOUND'. The one retry callback in proxyHealthcheck previously guarded its log behind if (error instanceof AxiosError); with fetch every error reaching that callback is HTTP/network-related, so the guard is dropped and the parameter omitted.

Removed the corresponding run_cypress/ entries from AXIOS_LEGACY_CONSUMERS in .eslintrc.js. New axios usage anywhere in this directory is now blocked by the existing global ban.

Behavior parity

  • Status-based retry decisions unchanged: res.ok is true exactly for 2xx, matching axios's auto-throw on non-2xx + error.response.status === 200 checks.
  • ENOTFOUND detection unchanged: fetch's wrapped cause.code matches axios's code for DNS failures.
  • Error log content preserved: messages still include status code and response body where the original did.
  • The catchAxiosErrorFormatAndThrow import (which would have required migrating the format_axios_error.ts utility owned by @elastic/security-defend-workflows) is no longer needed; that utility stays as-is for its other consumers and will be migrated in a later phase.

@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 5, 2026
@azasypkin azasypkin self-assigned this May 5, 2026
@kibanamachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

✅ unchanged

cc @azasypkin

@azasypkin azasypkin marked this pull request as ready for review May 5, 2026 11:36
@azasypkin azasypkin requested review from a team as code owners May 5, 2026 11:36
Authorization: `ApiKey ${this.apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is JSON.stringify(body) really needed here? In axios its not needed so I guess it does the serialization behind the scenes if its needed indeed. Right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Right! Responded in Slack, but will duplicate here for the records:

Axios does JSON.stringify for request body (+adds a correct Content-Type) and JSON.parse for response body automatically. The native fetch is more low-level, it only accepts strings, Blob, FormData, ArrayBuffer, URLSearchParams, or a ReadableStream for a request body (if one passes object it will just call toString() on it that will result into something like "[Object]") and requires consumers to parse body manually with json(), text() and so on (e.g. for perf reasons you might not want to call JSON.parse automatically and pay for that).

Using native fetch requires more boilerplate for sure, maybe eventually, when we all use fetch we can have some higher-level abstraction

@azasypkin azasypkin merged commit cbbfb6d into elastic:main May 5, 2026
74 checks passed
@azasypkin azasypkin deleted the issue-2244-remove-axios-phase-3 branch May 5, 2026 13:08
@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/25378278491

@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
9.3
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 267684

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request May 5, 2026
…om run_cypress scripts (#267684) (#267733)

# Backport

This will backport the following commits from `main` to `9.3`:
- [chore(axios,security-engineering-productivity): remove axios from
run_cypress scripts
(#267684)](#267684)

<!--- 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-05T13:08:17Z","message":"chore(axios,security-engineering-productivity):
remove axios from run_cypress scripts (#267684)\n\n## Summary\n\n**NOTE
TO CODE OWNERS:** I'm modifying code I don't own day to day.\nPlease
verify the changes still work as expected - for these migrations\na
quick run of the affected scripts/tests is worth more than a
code-only\nreview.\n\nThis PR removes the `axios` dependency for files
owned by\n`@elastic/security-engineering-productivity`. Phase 3 of the
axios\nmigration tracked under #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\nThree files
under\n`x-pack/solutions/security/plugins/security_solution/scripts/run_cypress/`,\nall
developer/CI scripts that spin up serverless test projects and
poll\ntheir readiness:\n\n- `parallel_serverless.ts` - 5 axios calls
(proxy healthcheck, ES\n`_cluster/health`, Kibana `/api/status`, ES
root, Kibana login).\nReplaced with `fetch` + explicit `res.ok` check +
typed `await\nres.json()`. Dropped the
`.catch(catchAxiosErrorFormatAndThrow)`\nwrappers that wrapped
AxiosError into FormattedAxiosError; replaced with\ninline `throw new
Error('${response.status}:${await response.text()}')`\nthat preserves
status+body in the error message. Folded
`'Content-Type':\n'application/json'` into the module-private
`API_HEADERS` constant and\nunwrapped `[ELASTIC_HTTP_VERSION_HEADER]:
[INITIAL_REST_VERSION]` to a\nbare string - axios was setting
Content-Type implicitly for object\nbodies and silently joining the
single-element array, neither of which\nfetch does.\n-
`cloud_project_handler.ts` - 4 axios calls (create project,
delete\nproject, reset credentials, status poll).\n-
`proxy_project_handler.ts` - same shape as
`cloud_project_handler.ts`\nwith proxy-specific URLs.\n\nBoth
project_handler files: catch blocks previously had an `if
(error\ninstanceof AxiosError) { log status:data } else { log message }`
branch;\nwith fetch the AxiosError branch is now dead, so they collapse
to a\nsingle `this.log.error(${error.message})`. The thrown error's
message\ncontains `${status}:${responseBody}` to preserve the same
diagnostic\ncontent.\n\nThe retry callbacks' `error instanceof
AxiosError && error.code ===\n'ENOTFOUND'` checks (used to log a
friendlier \"URL not yet reachable\"\nmessage during DNS failures) were
replaced with `(error as { cause?: {\ncode?: string } }).cause?.code ===
'ENOTFOUND'` — Node fetch wraps the\nunderlying network error on
`error.cause`, so DNS failures still surface\nwith `cause.code ===
'ENOTFOUND'`. The one retry callback in\n`proxyHealthcheck` previously
guarded its log behind `if (error\ninstanceof AxiosError)`; with fetch
every error reaching that callback\nis HTTP/network-related, so the
guard is dropped and the parameter\nomitted.\n\nRemoved the
corresponding `run_cypress/` entries from\n`AXIOS_LEGACY_CONSUMERS` in
`.eslintrc.js`. New axios usage anywhere in\nthis directory is now
blocked by the existing global ban.\n\n### Behavior parity\n\n-
Status-based retry decisions unchanged: `res.ok` is true exactly
for\n2xx, matching axios's auto-throw on non-2xx +
`error.response.status ===\n200` checks.\n- ENOTFOUND detection
unchanged: fetch's wrapped `cause.code` matches\naxios's `code` for DNS
failures.\n- Error log content preserved: messages still include status
code and\nresponse body where the original did.\n- The
`catchAxiosErrorFormatAndThrow` import (which would have
required\nmigrating the `format_axios_error.ts` utility owned
by\n`@elastic/security-defend-workflows`) is no longer needed; that
utility\nstays as-is for its other consumers and will be migrated in a
later\nphase.","sha":"cbbfb6d9139df3fcb8a07ae05b9dc484f580d6dd","branchLabelMapping":{"^v9.5.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["chore","release_note:skip","dependencies","backport:all-open","v9.5.0"],"title":"chore(axios,security-engineering-productivity):
remove axios from run_cypress
scripts","number":267684,"url":"https://github.com/elastic/kibana/pull/267684","mergeCommit":{"message":"chore(axios,security-engineering-productivity):
remove axios from run_cypress scripts (#267684)\n\n## Summary\n\n**NOTE
TO CODE OWNERS:** I'm modifying code I don't own day to day.\nPlease
verify the changes still work as expected - for these migrations\na
quick run of the affected scripts/tests is worth more than a
code-only\nreview.\n\nThis PR removes the `axios` dependency for files
owned by\n`@elastic/security-engineering-productivity`. Phase 3 of the
axios\nmigration tracked under #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\nThree files
under\n`x-pack/solutions/security/plugins/security_solution/scripts/run_cypress/`,\nall
developer/CI scripts that spin up serverless test projects and
poll\ntheir readiness:\n\n- `parallel_serverless.ts` - 5 axios calls
(proxy healthcheck, ES\n`_cluster/health`, Kibana `/api/status`, ES
root, Kibana login).\nReplaced with `fetch` + explicit `res.ok` check +
typed `await\nres.json()`. Dropped the
`.catch(catchAxiosErrorFormatAndThrow)`\nwrappers that wrapped
AxiosError into FormattedAxiosError; replaced with\ninline `throw new
Error('${response.status}:${await response.text()}')`\nthat preserves
status+body in the error message. Folded
`'Content-Type':\n'application/json'` into the module-private
`API_HEADERS` constant and\nunwrapped `[ELASTIC_HTTP_VERSION_HEADER]:
[INITIAL_REST_VERSION]` to a\nbare string - axios was setting
Content-Type implicitly for object\nbodies and silently joining the
single-element array, neither of which\nfetch does.\n-
`cloud_project_handler.ts` - 4 axios calls (create project,
delete\nproject, reset credentials, status poll).\n-
`proxy_project_handler.ts` - same shape as
`cloud_project_handler.ts`\nwith proxy-specific URLs.\n\nBoth
project_handler files: catch blocks previously had an `if
(error\ninstanceof AxiosError) { log status:data } else { log message }`
branch;\nwith fetch the AxiosError branch is now dead, so they collapse
to a\nsingle `this.log.error(${error.message})`. The thrown error's
message\ncontains `${status}:${responseBody}` to preserve the same
diagnostic\ncontent.\n\nThe retry callbacks' `error instanceof
AxiosError && error.code ===\n'ENOTFOUND'` checks (used to log a
friendlier \"URL not yet reachable\"\nmessage during DNS failures) were
replaced with `(error as { cause?: {\ncode?: string } }).cause?.code ===
'ENOTFOUND'` — Node fetch wraps the\nunderlying network error on
`error.cause`, so DNS failures still surface\nwith `cause.code ===
'ENOTFOUND'`. The one retry callback in\n`proxyHealthcheck` previously
guarded its log behind `if (error\ninstanceof AxiosError)`; with fetch
every error reaching that callback\nis HTTP/network-related, so the
guard is dropped and the parameter\nomitted.\n\nRemoved the
corresponding `run_cypress/` entries from\n`AXIOS_LEGACY_CONSUMERS` in
`.eslintrc.js`. New axios usage anywhere in\nthis directory is now
blocked by the existing global ban.\n\n### Behavior parity\n\n-
Status-based retry decisions unchanged: `res.ok` is true exactly
for\n2xx, matching axios's auto-throw on non-2xx +
`error.response.status ===\n200` checks.\n- ENOTFOUND detection
unchanged: fetch's wrapped `cause.code` matches\naxios's `code` for DNS
failures.\n- Error log content preserved: messages still include status
code and\nresponse body where the original did.\n- The
`catchAxiosErrorFormatAndThrow` import (which would have
required\nmigrating the `format_axios_error.ts` utility owned
by\n`@elastic/security-defend-workflows`) is no longer needed; that
utility\nstays as-is for its other consumers and will be migrated in a
later\nphase.","sha":"cbbfb6d9139df3fcb8a07ae05b9dc484f580d6dd"}},"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/267684","number":267684,"mergeCommit":{"message":"chore(axios,security-engineering-productivity):
remove axios from run_cypress scripts (#267684)\n\n## Summary\n\n**NOTE
TO CODE OWNERS:** I'm modifying code I don't own day to day.\nPlease
verify the changes still work as expected - for these migrations\na
quick run of the affected scripts/tests is worth more than a
code-only\nreview.\n\nThis PR removes the `axios` dependency for files
owned by\n`@elastic/security-engineering-productivity`. Phase 3 of the
axios\nmigration tracked under #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\nThree files
under\n`x-pack/solutions/security/plugins/security_solution/scripts/run_cypress/`,\nall
developer/CI scripts that spin up serverless test projects and
poll\ntheir readiness:\n\n- `parallel_serverless.ts` - 5 axios calls
(proxy healthcheck, ES\n`_cluster/health`, Kibana `/api/status`, ES
root, Kibana login).\nReplaced with `fetch` + explicit `res.ok` check +
typed `await\nres.json()`. Dropped the
`.catch(catchAxiosErrorFormatAndThrow)`\nwrappers that wrapped
AxiosError into FormattedAxiosError; replaced with\ninline `throw new
Error('${response.status}:${await response.text()}')`\nthat preserves
status+body in the error message. Folded
`'Content-Type':\n'application/json'` into the module-private
`API_HEADERS` constant and\nunwrapped `[ELASTIC_HTTP_VERSION_HEADER]:
[INITIAL_REST_VERSION]` to a\nbare string - axios was setting
Content-Type implicitly for object\nbodies and silently joining the
single-element array, neither of which\nfetch does.\n-
`cloud_project_handler.ts` - 4 axios calls (create project,
delete\nproject, reset credentials, status poll).\n-
`proxy_project_handler.ts` - same shape as
`cloud_project_handler.ts`\nwith proxy-specific URLs.\n\nBoth
project_handler files: catch blocks previously had an `if
(error\ninstanceof AxiosError) { log status:data } else { log message }`
branch;\nwith fetch the AxiosError branch is now dead, so they collapse
to a\nsingle `this.log.error(${error.message})`. The thrown error's
message\ncontains `${status}:${responseBody}` to preserve the same
diagnostic\ncontent.\n\nThe retry callbacks' `error instanceof
AxiosError && error.code ===\n'ENOTFOUND'` checks (used to log a
friendlier \"URL not yet reachable\"\nmessage during DNS failures) were
replaced with `(error as { cause?: {\ncode?: string } }).cause?.code ===
'ENOTFOUND'` — Node fetch wraps the\nunderlying network error on
`error.cause`, so DNS failures still surface\nwith `cause.code ===
'ENOTFOUND'`. The one retry callback in\n`proxyHealthcheck` previously
guarded its log behind `if (error\ninstanceof AxiosError)`; with fetch
every error reaching that callback\nis HTTP/network-related, so the
guard is dropped and the parameter\nomitted.\n\nRemoved the
corresponding `run_cypress/` entries from\n`AXIOS_LEGACY_CONSUMERS` in
`.eslintrc.js`. New axios usage anywhere in\nthis directory is now
blocked by the existing global ban.\n\n### Behavior parity\n\n-
Status-based retry decisions unchanged: `res.ok` is true exactly
for\n2xx, matching axios's auto-throw on non-2xx +
`error.response.status ===\n200` checks.\n- ENOTFOUND detection
unchanged: fetch's wrapped `cause.code` matches\naxios's `code` for DNS
failures.\n- Error log content preserved: messages still include status
code and\nresponse body where the original did.\n- The
`catchAxiosErrorFormatAndThrow` import (which would have
required\nmigrating the `format_axios_error.ts` utility owned
by\n`@elastic/security-defend-workflows`) is no longer needed; that
utility\nstays as-is for its other consumers and will be migrated in a
later\nphase.","sha":"cbbfb6d9139df3fcb8a07ae05b9dc484f580d6dd"}}]}]
BACKPORT-->

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

💚 All backports created successfully

Status Branch Result
8.19

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

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request May 5, 2026
…om run_cypress scripts (#267684) (#267732)

# Backport

This will backport the following commits from `main` to `9.2`:
- [chore(axios,security-engineering-productivity): remove axios from
run_cypress scripts
(#267684)](#267684)

<!--- 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-05T13:08:17Z","message":"chore(axios,security-engineering-productivity):
remove axios from run_cypress scripts (#267684)\n\n## Summary\n\n**NOTE
TO CODE OWNERS:** I'm modifying code I don't own day to day.\nPlease
verify the changes still work as expected - for these migrations\na
quick run of the affected scripts/tests is worth more than a
code-only\nreview.\n\nThis PR removes the `axios` dependency for files
owned by\n`@elastic/security-engineering-productivity`. Phase 3 of the
axios\nmigration tracked under #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\nThree files
under\n`x-pack/solutions/security/plugins/security_solution/scripts/run_cypress/`,\nall
developer/CI scripts that spin up serverless test projects and
poll\ntheir readiness:\n\n- `parallel_serverless.ts` - 5 axios calls
(proxy healthcheck, ES\n`_cluster/health`, Kibana `/api/status`, ES
root, Kibana login).\nReplaced with `fetch` + explicit `res.ok` check +
typed `await\nres.json()`. Dropped the
`.catch(catchAxiosErrorFormatAndThrow)`\nwrappers that wrapped
AxiosError into FormattedAxiosError; replaced with\ninline `throw new
Error('${response.status}:${await response.text()}')`\nthat preserves
status+body in the error message. Folded
`'Content-Type':\n'application/json'` into the module-private
`API_HEADERS` constant and\nunwrapped `[ELASTIC_HTTP_VERSION_HEADER]:
[INITIAL_REST_VERSION]` to a\nbare string - axios was setting
Content-Type implicitly for object\nbodies and silently joining the
single-element array, neither of which\nfetch does.\n-
`cloud_project_handler.ts` - 4 axios calls (create project,
delete\nproject, reset credentials, status poll).\n-
`proxy_project_handler.ts` - same shape as
`cloud_project_handler.ts`\nwith proxy-specific URLs.\n\nBoth
project_handler files: catch blocks previously had an `if
(error\ninstanceof AxiosError) { log status:data } else { log message }`
branch;\nwith fetch the AxiosError branch is now dead, so they collapse
to a\nsingle `this.log.error(${error.message})`. The thrown error's
message\ncontains `${status}:${responseBody}` to preserve the same
diagnostic\ncontent.\n\nThe retry callbacks' `error instanceof
AxiosError && error.code ===\n'ENOTFOUND'` checks (used to log a
friendlier \"URL not yet reachable\"\nmessage during DNS failures) were
replaced with `(error as { cause?: {\ncode?: string } }).cause?.code ===
'ENOTFOUND'` — Node fetch wraps the\nunderlying network error on
`error.cause`, so DNS failures still surface\nwith `cause.code ===
'ENOTFOUND'`. The one retry callback in\n`proxyHealthcheck` previously
guarded its log behind `if (error\ninstanceof AxiosError)`; with fetch
every error reaching that callback\nis HTTP/network-related, so the
guard is dropped and the parameter\nomitted.\n\nRemoved the
corresponding `run_cypress/` entries from\n`AXIOS_LEGACY_CONSUMERS` in
`.eslintrc.js`. New axios usage anywhere in\nthis directory is now
blocked by the existing global ban.\n\n### Behavior parity\n\n-
Status-based retry decisions unchanged: `res.ok` is true exactly
for\n2xx, matching axios's auto-throw on non-2xx +
`error.response.status ===\n200` checks.\n- ENOTFOUND detection
unchanged: fetch's wrapped `cause.code` matches\naxios's `code` for DNS
failures.\n- Error log content preserved: messages still include status
code and\nresponse body where the original did.\n- The
`catchAxiosErrorFormatAndThrow` import (which would have
required\nmigrating the `format_axios_error.ts` utility owned
by\n`@elastic/security-defend-workflows`) is no longer needed; that
utility\nstays as-is for its other consumers and will be migrated in a
later\nphase.","sha":"cbbfb6d9139df3fcb8a07ae05b9dc484f580d6dd","branchLabelMapping":{"^v9.5.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["chore","release_note:skip","dependencies","backport:all-open","v9.5.0"],"title":"chore(axios,security-engineering-productivity):
remove axios from run_cypress
scripts","number":267684,"url":"https://github.com/elastic/kibana/pull/267684","mergeCommit":{"message":"chore(axios,security-engineering-productivity):
remove axios from run_cypress scripts (#267684)\n\n## Summary\n\n**NOTE
TO CODE OWNERS:** I'm modifying code I don't own day to day.\nPlease
verify the changes still work as expected - for these migrations\na
quick run of the affected scripts/tests is worth more than a
code-only\nreview.\n\nThis PR removes the `axios` dependency for files
owned by\n`@elastic/security-engineering-productivity`. Phase 3 of the
axios\nmigration tracked under #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\nThree files
under\n`x-pack/solutions/security/plugins/security_solution/scripts/run_cypress/`,\nall
developer/CI scripts that spin up serverless test projects and
poll\ntheir readiness:\n\n- `parallel_serverless.ts` - 5 axios calls
(proxy healthcheck, ES\n`_cluster/health`, Kibana `/api/status`, ES
root, Kibana login).\nReplaced with `fetch` + explicit `res.ok` check +
typed `await\nres.json()`. Dropped the
`.catch(catchAxiosErrorFormatAndThrow)`\nwrappers that wrapped
AxiosError into FormattedAxiosError; replaced with\ninline `throw new
Error('${response.status}:${await response.text()}')`\nthat preserves
status+body in the error message. Folded
`'Content-Type':\n'application/json'` into the module-private
`API_HEADERS` constant and\nunwrapped `[ELASTIC_HTTP_VERSION_HEADER]:
[INITIAL_REST_VERSION]` to a\nbare string - axios was setting
Content-Type implicitly for object\nbodies and silently joining the
single-element array, neither of which\nfetch does.\n-
`cloud_project_handler.ts` - 4 axios calls (create project,
delete\nproject, reset credentials, status poll).\n-
`proxy_project_handler.ts` - same shape as
`cloud_project_handler.ts`\nwith proxy-specific URLs.\n\nBoth
project_handler files: catch blocks previously had an `if
(error\ninstanceof AxiosError) { log status:data } else { log message }`
branch;\nwith fetch the AxiosError branch is now dead, so they collapse
to a\nsingle `this.log.error(${error.message})`. The thrown error's
message\ncontains `${status}:${responseBody}` to preserve the same
diagnostic\ncontent.\n\nThe retry callbacks' `error instanceof
AxiosError && error.code ===\n'ENOTFOUND'` checks (used to log a
friendlier \"URL not yet reachable\"\nmessage during DNS failures) were
replaced with `(error as { cause?: {\ncode?: string } }).cause?.code ===
'ENOTFOUND'` — Node fetch wraps the\nunderlying network error on
`error.cause`, so DNS failures still surface\nwith `cause.code ===
'ENOTFOUND'`. The one retry callback in\n`proxyHealthcheck` previously
guarded its log behind `if (error\ninstanceof AxiosError)`; with fetch
every error reaching that callback\nis HTTP/network-related, so the
guard is dropped and the parameter\nomitted.\n\nRemoved the
corresponding `run_cypress/` entries from\n`AXIOS_LEGACY_CONSUMERS` in
`.eslintrc.js`. New axios usage anywhere in\nthis directory is now
blocked by the existing global ban.\n\n### Behavior parity\n\n-
Status-based retry decisions unchanged: `res.ok` is true exactly
for\n2xx, matching axios's auto-throw on non-2xx +
`error.response.status ===\n200` checks.\n- ENOTFOUND detection
unchanged: fetch's wrapped `cause.code` matches\naxios's `code` for DNS
failures.\n- Error log content preserved: messages still include status
code and\nresponse body where the original did.\n- The
`catchAxiosErrorFormatAndThrow` import (which would have
required\nmigrating the `format_axios_error.ts` utility owned
by\n`@elastic/security-defend-workflows`) is no longer needed; that
utility\nstays as-is for its other consumers and will be migrated in a
later\nphase.","sha":"cbbfb6d9139df3fcb8a07ae05b9dc484f580d6dd"}},"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/267684","number":267684,"mergeCommit":{"message":"chore(axios,security-engineering-productivity):
remove axios from run_cypress scripts (#267684)\n\n## Summary\n\n**NOTE
TO CODE OWNERS:** I'm modifying code I don't own day to day.\nPlease
verify the changes still work as expected - for these migrations\na
quick run of the affected scripts/tests is worth more than a
code-only\nreview.\n\nThis PR removes the `axios` dependency for files
owned by\n`@elastic/security-engineering-productivity`. Phase 3 of the
axios\nmigration tracked under #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\nThree files
under\n`x-pack/solutions/security/plugins/security_solution/scripts/run_cypress/`,\nall
developer/CI scripts that spin up serverless test projects and
poll\ntheir readiness:\n\n- `parallel_serverless.ts` - 5 axios calls
(proxy healthcheck, ES\n`_cluster/health`, Kibana `/api/status`, ES
root, Kibana login).\nReplaced with `fetch` + explicit `res.ok` check +
typed `await\nres.json()`. Dropped the
`.catch(catchAxiosErrorFormatAndThrow)`\nwrappers that wrapped
AxiosError into FormattedAxiosError; replaced with\ninline `throw new
Error('${response.status}:${await response.text()}')`\nthat preserves
status+body in the error message. Folded
`'Content-Type':\n'application/json'` into the module-private
`API_HEADERS` constant and\nunwrapped `[ELASTIC_HTTP_VERSION_HEADER]:
[INITIAL_REST_VERSION]` to a\nbare string - axios was setting
Content-Type implicitly for object\nbodies and silently joining the
single-element array, neither of which\nfetch does.\n-
`cloud_project_handler.ts` - 4 axios calls (create project,
delete\nproject, reset credentials, status poll).\n-
`proxy_project_handler.ts` - same shape as
`cloud_project_handler.ts`\nwith proxy-specific URLs.\n\nBoth
project_handler files: catch blocks previously had an `if
(error\ninstanceof AxiosError) { log status:data } else { log message }`
branch;\nwith fetch the AxiosError branch is now dead, so they collapse
to a\nsingle `this.log.error(${error.message})`. The thrown error's
message\ncontains `${status}:${responseBody}` to preserve the same
diagnostic\ncontent.\n\nThe retry callbacks' `error instanceof
AxiosError && error.code ===\n'ENOTFOUND'` checks (used to log a
friendlier \"URL not yet reachable\"\nmessage during DNS failures) were
replaced with `(error as { cause?: {\ncode?: string } }).cause?.code ===
'ENOTFOUND'` — Node fetch wraps the\nunderlying network error on
`error.cause`, so DNS failures still surface\nwith `cause.code ===
'ENOTFOUND'`. The one retry callback in\n`proxyHealthcheck` previously
guarded its log behind `if (error\ninstanceof AxiosError)`; with fetch
every error reaching that callback\nis HTTP/network-related, so the
guard is dropped and the parameter\nomitted.\n\nRemoved the
corresponding `run_cypress/` entries from\n`AXIOS_LEGACY_CONSUMERS` in
`.eslintrc.js`. New axios usage anywhere in\nthis directory is now
blocked by the existing global ban.\n\n### Behavior parity\n\n-
Status-based retry decisions unchanged: `res.ok` is true exactly
for\n2xx, matching axios's auto-throw on non-2xx +
`error.response.status ===\n200` checks.\n- ENOTFOUND detection
unchanged: fetch's wrapped `cause.code` matches\naxios's `code` for DNS
failures.\n- Error log content preserved: messages still include status
code and\nresponse body where the original did.\n- The
`catchAxiosErrorFormatAndThrow` import (which would have
required\nmigrating the `format_axios_error.ts` utility owned
by\n`@elastic/security-defend-workflows`) is no longer needed; that
utility\nstays as-is for its other consumers and will be migrated in a
later\nphase.","sha":"cbbfb6d9139df3fcb8a07ae05b9dc484f580d6dd"}}]}]
BACKPORT-->

Co-authored-by: Aleh Zasypkin <aleh.zasypkin@elastic.co>
kibanamachine added a commit that referenced this pull request May 5, 2026
…om run_cypress scripts (#267684) (#267734)

# Backport

This will backport the following commits from `main` to `9.4`:
- [chore(axios,security-engineering-productivity): remove axios from
run_cypress scripts
(#267684)](#267684)

<!--- 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-05T13:08:17Z","message":"chore(axios,security-engineering-productivity):
remove axios from run_cypress scripts (#267684)\n\n## Summary\n\n**NOTE
TO CODE OWNERS:** I'm modifying code I don't own day to day.\nPlease
verify the changes still work as expected - for these migrations\na
quick run of the affected scripts/tests is worth more than a
code-only\nreview.\n\nThis PR removes the `axios` dependency for files
owned by\n`@elastic/security-engineering-productivity`. Phase 3 of the
axios\nmigration tracked under #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\nThree files
under\n`x-pack/solutions/security/plugins/security_solution/scripts/run_cypress/`,\nall
developer/CI scripts that spin up serverless test projects and
poll\ntheir readiness:\n\n- `parallel_serverless.ts` - 5 axios calls
(proxy healthcheck, ES\n`_cluster/health`, Kibana `/api/status`, ES
root, Kibana login).\nReplaced with `fetch` + explicit `res.ok` check +
typed `await\nres.json()`. Dropped the
`.catch(catchAxiosErrorFormatAndThrow)`\nwrappers that wrapped
AxiosError into FormattedAxiosError; replaced with\ninline `throw new
Error('${response.status}:${await response.text()}')`\nthat preserves
status+body in the error message. Folded
`'Content-Type':\n'application/json'` into the module-private
`API_HEADERS` constant and\nunwrapped `[ELASTIC_HTTP_VERSION_HEADER]:
[INITIAL_REST_VERSION]` to a\nbare string - axios was setting
Content-Type implicitly for object\nbodies and silently joining the
single-element array, neither of which\nfetch does.\n-
`cloud_project_handler.ts` - 4 axios calls (create project,
delete\nproject, reset credentials, status poll).\n-
`proxy_project_handler.ts` - same shape as
`cloud_project_handler.ts`\nwith proxy-specific URLs.\n\nBoth
project_handler files: catch blocks previously had an `if
(error\ninstanceof AxiosError) { log status:data } else { log message }`
branch;\nwith fetch the AxiosError branch is now dead, so they collapse
to a\nsingle `this.log.error(${error.message})`. The thrown error's
message\ncontains `${status}:${responseBody}` to preserve the same
diagnostic\ncontent.\n\nThe retry callbacks' `error instanceof
AxiosError && error.code ===\n'ENOTFOUND'` checks (used to log a
friendlier \"URL not yet reachable\"\nmessage during DNS failures) were
replaced with `(error as { cause?: {\ncode?: string } }).cause?.code ===
'ENOTFOUND'` — Node fetch wraps the\nunderlying network error on
`error.cause`, so DNS failures still surface\nwith `cause.code ===
'ENOTFOUND'`. The one retry callback in\n`proxyHealthcheck` previously
guarded its log behind `if (error\ninstanceof AxiosError)`; with fetch
every error reaching that callback\nis HTTP/network-related, so the
guard is dropped and the parameter\nomitted.\n\nRemoved the
corresponding `run_cypress/` entries from\n`AXIOS_LEGACY_CONSUMERS` in
`.eslintrc.js`. New axios usage anywhere in\nthis directory is now
blocked by the existing global ban.\n\n### Behavior parity\n\n-
Status-based retry decisions unchanged: `res.ok` is true exactly
for\n2xx, matching axios's auto-throw on non-2xx +
`error.response.status ===\n200` checks.\n- ENOTFOUND detection
unchanged: fetch's wrapped `cause.code` matches\naxios's `code` for DNS
failures.\n- Error log content preserved: messages still include status
code and\nresponse body where the original did.\n- The
`catchAxiosErrorFormatAndThrow` import (which would have
required\nmigrating the `format_axios_error.ts` utility owned
by\n`@elastic/security-defend-workflows`) is no longer needed; that
utility\nstays as-is for its other consumers and will be migrated in a
later\nphase.","sha":"cbbfb6d9139df3fcb8a07ae05b9dc484f580d6dd","branchLabelMapping":{"^v9.5.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["chore","release_note:skip","dependencies","backport:all-open","v9.5.0"],"title":"chore(axios,security-engineering-productivity):
remove axios from run_cypress
scripts","number":267684,"url":"https://github.com/elastic/kibana/pull/267684","mergeCommit":{"message":"chore(axios,security-engineering-productivity):
remove axios from run_cypress scripts (#267684)\n\n## Summary\n\n**NOTE
TO CODE OWNERS:** I'm modifying code I don't own day to day.\nPlease
verify the changes still work as expected - for these migrations\na
quick run of the affected scripts/tests is worth more than a
code-only\nreview.\n\nThis PR removes the `axios` dependency for files
owned by\n`@elastic/security-engineering-productivity`. Phase 3 of the
axios\nmigration tracked under #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\nThree files
under\n`x-pack/solutions/security/plugins/security_solution/scripts/run_cypress/`,\nall
developer/CI scripts that spin up serverless test projects and
poll\ntheir readiness:\n\n- `parallel_serverless.ts` - 5 axios calls
(proxy healthcheck, ES\n`_cluster/health`, Kibana `/api/status`, ES
root, Kibana login).\nReplaced with `fetch` + explicit `res.ok` check +
typed `await\nres.json()`. Dropped the
`.catch(catchAxiosErrorFormatAndThrow)`\nwrappers that wrapped
AxiosError into FormattedAxiosError; replaced with\ninline `throw new
Error('${response.status}:${await response.text()}')`\nthat preserves
status+body in the error message. Folded
`'Content-Type':\n'application/json'` into the module-private
`API_HEADERS` constant and\nunwrapped `[ELASTIC_HTTP_VERSION_HEADER]:
[INITIAL_REST_VERSION]` to a\nbare string - axios was setting
Content-Type implicitly for object\nbodies and silently joining the
single-element array, neither of which\nfetch does.\n-
`cloud_project_handler.ts` - 4 axios calls (create project,
delete\nproject, reset credentials, status poll).\n-
`proxy_project_handler.ts` - same shape as
`cloud_project_handler.ts`\nwith proxy-specific URLs.\n\nBoth
project_handler files: catch blocks previously had an `if
(error\ninstanceof AxiosError) { log status:data } else { log message }`
branch;\nwith fetch the AxiosError branch is now dead, so they collapse
to a\nsingle `this.log.error(${error.message})`. The thrown error's
message\ncontains `${status}:${responseBody}` to preserve the same
diagnostic\ncontent.\n\nThe retry callbacks' `error instanceof
AxiosError && error.code ===\n'ENOTFOUND'` checks (used to log a
friendlier \"URL not yet reachable\"\nmessage during DNS failures) were
replaced with `(error as { cause?: {\ncode?: string } }).cause?.code ===
'ENOTFOUND'` — Node fetch wraps the\nunderlying network error on
`error.cause`, so DNS failures still surface\nwith `cause.code ===
'ENOTFOUND'`. The one retry callback in\n`proxyHealthcheck` previously
guarded its log behind `if (error\ninstanceof AxiosError)`; with fetch
every error reaching that callback\nis HTTP/network-related, so the
guard is dropped and the parameter\nomitted.\n\nRemoved the
corresponding `run_cypress/` entries from\n`AXIOS_LEGACY_CONSUMERS` in
`.eslintrc.js`. New axios usage anywhere in\nthis directory is now
blocked by the existing global ban.\n\n### Behavior parity\n\n-
Status-based retry decisions unchanged: `res.ok` is true exactly
for\n2xx, matching axios's auto-throw on non-2xx +
`error.response.status ===\n200` checks.\n- ENOTFOUND detection
unchanged: fetch's wrapped `cause.code` matches\naxios's `code` for DNS
failures.\n- Error log content preserved: messages still include status
code and\nresponse body where the original did.\n- The
`catchAxiosErrorFormatAndThrow` import (which would have
required\nmigrating the `format_axios_error.ts` utility owned
by\n`@elastic/security-defend-workflows`) is no longer needed; that
utility\nstays as-is for its other consumers and will be migrated in a
later\nphase.","sha":"cbbfb6d9139df3fcb8a07ae05b9dc484f580d6dd"}},"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/267684","number":267684,"mergeCommit":{"message":"chore(axios,security-engineering-productivity):
remove axios from run_cypress scripts (#267684)\n\n## Summary\n\n**NOTE
TO CODE OWNERS:** I'm modifying code I don't own day to day.\nPlease
verify the changes still work as expected - for these migrations\na
quick run of the affected scripts/tests is worth more than a
code-only\nreview.\n\nThis PR removes the `axios` dependency for files
owned by\n`@elastic/security-engineering-productivity`. Phase 3 of the
axios\nmigration tracked under #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\nThree files
under\n`x-pack/solutions/security/plugins/security_solution/scripts/run_cypress/`,\nall
developer/CI scripts that spin up serverless test projects and
poll\ntheir readiness:\n\n- `parallel_serverless.ts` - 5 axios calls
(proxy healthcheck, ES\n`_cluster/health`, Kibana `/api/status`, ES
root, Kibana login).\nReplaced with `fetch` + explicit `res.ok` check +
typed `await\nres.json()`. Dropped the
`.catch(catchAxiosErrorFormatAndThrow)`\nwrappers that wrapped
AxiosError into FormattedAxiosError; replaced with\ninline `throw new
Error('${response.status}:${await response.text()}')`\nthat preserves
status+body in the error message. Folded
`'Content-Type':\n'application/json'` into the module-private
`API_HEADERS` constant and\nunwrapped `[ELASTIC_HTTP_VERSION_HEADER]:
[INITIAL_REST_VERSION]` to a\nbare string - axios was setting
Content-Type implicitly for object\nbodies and silently joining the
single-element array, neither of which\nfetch does.\n-
`cloud_project_handler.ts` - 4 axios calls (create project,
delete\nproject, reset credentials, status poll).\n-
`proxy_project_handler.ts` - same shape as
`cloud_project_handler.ts`\nwith proxy-specific URLs.\n\nBoth
project_handler files: catch blocks previously had an `if
(error\ninstanceof AxiosError) { log status:data } else { log message }`
branch;\nwith fetch the AxiosError branch is now dead, so they collapse
to a\nsingle `this.log.error(${error.message})`. The thrown error's
message\ncontains `${status}:${responseBody}` to preserve the same
diagnostic\ncontent.\n\nThe retry callbacks' `error instanceof
AxiosError && error.code ===\n'ENOTFOUND'` checks (used to log a
friendlier \"URL not yet reachable\"\nmessage during DNS failures) were
replaced with `(error as { cause?: {\ncode?: string } }).cause?.code ===
'ENOTFOUND'` — Node fetch wraps the\nunderlying network error on
`error.cause`, so DNS failures still surface\nwith `cause.code ===
'ENOTFOUND'`. The one retry callback in\n`proxyHealthcheck` previously
guarded its log behind `if (error\ninstanceof AxiosError)`; with fetch
every error reaching that callback\nis HTTP/network-related, so the
guard is dropped and the parameter\nomitted.\n\nRemoved the
corresponding `run_cypress/` entries from\n`AXIOS_LEGACY_CONSUMERS` in
`.eslintrc.js`. New axios usage anywhere in\nthis directory is now
blocked by the existing global ban.\n\n### Behavior parity\n\n-
Status-based retry decisions unchanged: `res.ok` is true exactly
for\n2xx, matching axios's auto-throw on non-2xx +
`error.response.status ===\n200` checks.\n- ENOTFOUND detection
unchanged: fetch's wrapped `cause.code` matches\naxios's `code` for DNS
failures.\n- Error log content preserved: messages still include status
code and\nresponse body where the original did.\n- The
`catchAxiosErrorFormatAndThrow` import (which would have
required\nmigrating the `format_axios_error.ts` utility owned
by\n`@elastic/security-defend-workflows`) is no longer needed; that
utility\nstays as-is for its other consumers and will be migrated in a
later\nphase.","sha":"cbbfb6d9139df3fcb8a07ae05b9dc484f580d6dd"}}]}]
BACKPORT-->

Co-authored-by: Aleh Zasypkin <aleh.zasypkin@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
azasypkin added a commit that referenced this pull request May 6, 2026
…rom run_cypress scripts (#267684) (#267765)

# Backport

This will backport the following commits from `main` to `8.19`:
- [chore(axios,security-engineering-productivity): remove axios from
run_cypress scripts
(#267684)](#267684)

<!--- 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-05T13:08:17Z","message":"chore(axios,security-engineering-productivity):
remove axios from run_cypress scripts (#267684)\n\n## Summary\n\n**NOTE
TO CODE OWNERS:** I'm modifying code I don't own day to day.\nPlease
verify the changes still work as expected - for these migrations\na
quick run of the affected scripts/tests is worth more than a
code-only\nreview.\n\nThis PR removes the `axios` dependency for files
owned by\n`@elastic/security-engineering-productivity`. Phase 3 of the
axios\nmigration tracked under #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\nThree files
under\n`x-pack/solutions/security/plugins/security_solution/scripts/run_cypress/`,\nall
developer/CI scripts that spin up serverless test projects and
poll\ntheir readiness:\n\n- `parallel_serverless.ts` - 5 axios calls
(proxy healthcheck, ES\n`_cluster/health`, Kibana `/api/status`, ES
root, Kibana login).\nReplaced with `fetch` + explicit `res.ok` check +
typed `await\nres.json()`. Dropped the
`.catch(catchAxiosErrorFormatAndThrow)`\nwrappers that wrapped
AxiosError into FormattedAxiosError; replaced with\ninline `throw new
Error('${response.status}:${await response.text()}')`\nthat preserves
status+body in the error message. Folded
`'Content-Type':\n'application/json'` into the module-private
`API_HEADERS` constant and\nunwrapped `[ELASTIC_HTTP_VERSION_HEADER]:
[INITIAL_REST_VERSION]` to a\nbare string - axios was setting
Content-Type implicitly for object\nbodies and silently joining the
single-element array, neither of which\nfetch does.\n-
`cloud_project_handler.ts` - 4 axios calls (create project,
delete\nproject, reset credentials, status poll).\n-
`proxy_project_handler.ts` - same shape as
`cloud_project_handler.ts`\nwith proxy-specific URLs.\n\nBoth
project_handler files: catch blocks previously had an `if
(error\ninstanceof AxiosError) { log status:data } else { log message }`
branch;\nwith fetch the AxiosError branch is now dead, so they collapse
to a\nsingle `this.log.error(${error.message})`. The thrown error's
message\ncontains `${status}:${responseBody}` to preserve the same
diagnostic\ncontent.\n\nThe retry callbacks' `error instanceof
AxiosError && error.code ===\n'ENOTFOUND'` checks (used to log a
friendlier \"URL not yet reachable\"\nmessage during DNS failures) were
replaced with `(error as { cause?: {\ncode?: string } }).cause?.code ===
'ENOTFOUND'` — Node fetch wraps the\nunderlying network error on
`error.cause`, so DNS failures still surface\nwith `cause.code ===
'ENOTFOUND'`. The one retry callback in\n`proxyHealthcheck` previously
guarded its log behind `if (error\ninstanceof AxiosError)`; with fetch
every error reaching that callback\nis HTTP/network-related, so the
guard is dropped and the parameter\nomitted.\n\nRemoved the
corresponding `run_cypress/` entries from\n`AXIOS_LEGACY_CONSUMERS` in
`.eslintrc.js`. New axios usage anywhere in\nthis directory is now
blocked by the existing global ban.\n\n### Behavior parity\n\n-
Status-based retry decisions unchanged: `res.ok` is true exactly
for\n2xx, matching axios's auto-throw on non-2xx +
`error.response.status ===\n200` checks.\n- ENOTFOUND detection
unchanged: fetch's wrapped `cause.code` matches\naxios's `code` for DNS
failures.\n- Error log content preserved: messages still include status
code and\nresponse body where the original did.\n- The
`catchAxiosErrorFormatAndThrow` import (which would have
required\nmigrating the `format_axios_error.ts` utility owned
by\n`@elastic/security-defend-workflows`) is no longer needed; that
utility\nstays as-is for its other consumers and will be migrated in a
later\nphase.","sha":"cbbfb6d9139df3fcb8a07ae05b9dc484f580d6dd","branchLabelMapping":{"^v9.5.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["chore","release_note:skip","dependencies","backport:all-open","v9.5.0"],"title":"chore(axios,security-engineering-productivity):
remove axios from run_cypress
scripts","number":267684,"url":"https://github.com/elastic/kibana/pull/267684","mergeCommit":{"message":"chore(axios,security-engineering-productivity):
remove axios from run_cypress scripts (#267684)\n\n## Summary\n\n**NOTE
TO CODE OWNERS:** I'm modifying code I don't own day to day.\nPlease
verify the changes still work as expected - for these migrations\na
quick run of the affected scripts/tests is worth more than a
code-only\nreview.\n\nThis PR removes the `axios` dependency for files
owned by\n`@elastic/security-engineering-productivity`. Phase 3 of the
axios\nmigration tracked under #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\nThree files
under\n`x-pack/solutions/security/plugins/security_solution/scripts/run_cypress/`,\nall
developer/CI scripts that spin up serverless test projects and
poll\ntheir readiness:\n\n- `parallel_serverless.ts` - 5 axios calls
(proxy healthcheck, ES\n`_cluster/health`, Kibana `/api/status`, ES
root, Kibana login).\nReplaced with `fetch` + explicit `res.ok` check +
typed `await\nres.json()`. Dropped the
`.catch(catchAxiosErrorFormatAndThrow)`\nwrappers that wrapped
AxiosError into FormattedAxiosError; replaced with\ninline `throw new
Error('${response.status}:${await response.text()}')`\nthat preserves
status+body in the error message. Folded
`'Content-Type':\n'application/json'` into the module-private
`API_HEADERS` constant and\nunwrapped `[ELASTIC_HTTP_VERSION_HEADER]:
[INITIAL_REST_VERSION]` to a\nbare string - axios was setting
Content-Type implicitly for object\nbodies and silently joining the
single-element array, neither of which\nfetch does.\n-
`cloud_project_handler.ts` - 4 axios calls (create project,
delete\nproject, reset credentials, status poll).\n-
`proxy_project_handler.ts` - same shape as
`cloud_project_handler.ts`\nwith proxy-specific URLs.\n\nBoth
project_handler files: catch blocks previously had an `if
(error\ninstanceof AxiosError) { log status:data } else { log message }`
branch;\nwith fetch the AxiosError branch is now dead, so they collapse
to a\nsingle `this.log.error(${error.message})`. The thrown error's
message\ncontains `${status}:${responseBody}` to preserve the same
diagnostic\ncontent.\n\nThe retry callbacks' `error instanceof
AxiosError && error.code ===\n'ENOTFOUND'` checks (used to log a
friendlier \"URL not yet reachable\"\nmessage during DNS failures) were
replaced with `(error as { cause?: {\ncode?: string } }).cause?.code ===
'ENOTFOUND'` — Node fetch wraps the\nunderlying network error on
`error.cause`, so DNS failures still surface\nwith `cause.code ===
'ENOTFOUND'`. The one retry callback in\n`proxyHealthcheck` previously
guarded its log behind `if (error\ninstanceof AxiosError)`; with fetch
every error reaching that callback\nis HTTP/network-related, so the
guard is dropped and the parameter\nomitted.\n\nRemoved the
corresponding `run_cypress/` entries from\n`AXIOS_LEGACY_CONSUMERS` in
`.eslintrc.js`. New axios usage anywhere in\nthis directory is now
blocked by the existing global ban.\n\n### Behavior parity\n\n-
Status-based retry decisions unchanged: `res.ok` is true exactly
for\n2xx, matching axios's auto-throw on non-2xx +
`error.response.status ===\n200` checks.\n- ENOTFOUND detection
unchanged: fetch's wrapped `cause.code` matches\naxios's `code` for DNS
failures.\n- Error log content preserved: messages still include status
code and\nresponse body where the original did.\n- The
`catchAxiosErrorFormatAndThrow` import (which would have
required\nmigrating the `format_axios_error.ts` utility owned
by\n`@elastic/security-defend-workflows`) is no longer needed; that
utility\nstays as-is for its other consumers and will be migrated in a
later\nphase.","sha":"cbbfb6d9139df3fcb8a07ae05b9dc484f580d6dd"}},"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/267684","number":267684,"mergeCommit":{"message":"chore(axios,security-engineering-productivity):
remove axios from run_cypress scripts (#267684)\n\n## Summary\n\n**NOTE
TO CODE OWNERS:** I'm modifying code I don't own day to day.\nPlease
verify the changes still work as expected - for these migrations\na
quick run of the affected scripts/tests is worth more than a
code-only\nreview.\n\nThis PR removes the `axios` dependency for files
owned by\n`@elastic/security-engineering-productivity`. Phase 3 of the
axios\nmigration tracked under #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\nThree files
under\n`x-pack/solutions/security/plugins/security_solution/scripts/run_cypress/`,\nall
developer/CI scripts that spin up serverless test projects and
poll\ntheir readiness:\n\n- `parallel_serverless.ts` - 5 axios calls
(proxy healthcheck, ES\n`_cluster/health`, Kibana `/api/status`, ES
root, Kibana login).\nReplaced with `fetch` + explicit `res.ok` check +
typed `await\nres.json()`. Dropped the
`.catch(catchAxiosErrorFormatAndThrow)`\nwrappers that wrapped
AxiosError into FormattedAxiosError; replaced with\ninline `throw new
Error('${response.status}:${await response.text()}')`\nthat preserves
status+body in the error message. Folded
`'Content-Type':\n'application/json'` into the module-private
`API_HEADERS` constant and\nunwrapped `[ELASTIC_HTTP_VERSION_HEADER]:
[INITIAL_REST_VERSION]` to a\nbare string - axios was setting
Content-Type implicitly for object\nbodies and silently joining the
single-element array, neither of which\nfetch does.\n-
`cloud_project_handler.ts` - 4 axios calls (create project,
delete\nproject, reset credentials, status poll).\n-
`proxy_project_handler.ts` - same shape as
`cloud_project_handler.ts`\nwith proxy-specific URLs.\n\nBoth
project_handler files: catch blocks previously had an `if
(error\ninstanceof AxiosError) { log status:data } else { log message }`
branch;\nwith fetch the AxiosError branch is now dead, so they collapse
to a\nsingle `this.log.error(${error.message})`. The thrown error's
message\ncontains `${status}:${responseBody}` to preserve the same
diagnostic\ncontent.\n\nThe retry callbacks' `error instanceof
AxiosError && error.code ===\n'ENOTFOUND'` checks (used to log a
friendlier \"URL not yet reachable\"\nmessage during DNS failures) were
replaced with `(error as { cause?: {\ncode?: string } }).cause?.code ===
'ENOTFOUND'` — Node fetch wraps the\nunderlying network error on
`error.cause`, so DNS failures still surface\nwith `cause.code ===
'ENOTFOUND'`. The one retry callback in\n`proxyHealthcheck` previously
guarded its log behind `if (error\ninstanceof AxiosError)`; with fetch
every error reaching that callback\nis HTTP/network-related, so the
guard is dropped and the parameter\nomitted.\n\nRemoved the
corresponding `run_cypress/` entries from\n`AXIOS_LEGACY_CONSUMERS` in
`.eslintrc.js`. New axios usage anywhere in\nthis directory is now
blocked by the existing global ban.\n\n### Behavior parity\n\n-
Status-based retry decisions unchanged: `res.ok` is true exactly
for\n2xx, matching axios's auto-throw on non-2xx +
`error.response.status ===\n200` checks.\n- ENOTFOUND detection
unchanged: fetch's wrapped `cause.code` matches\naxios's `code` for DNS
failures.\n- Error log content preserved: messages still include status
code and\nresponse body where the original did.\n- The
`catchAxiosErrorFormatAndThrow` import (which would have
required\nmigrating the `format_axios_error.ts` utility owned
by\n`@elastic/security-defend-workflows`) is no longer needed; that
utility\nstays as-is for its other consumers and will be migrated in a
later\nphase.","sha":"cbbfb6d9139df3fcb8a07ae05b9dc484f580d6dd"}},{"url":"https://github.com/elastic/kibana/pull/267732","number":267732,"branch":"9.2","state":"OPEN"},{"url":"https://github.com/elastic/kibana/pull/267733","number":267733,"branch":"9.3","state":"OPEN"},{"url":"https://github.com/elastic/kibana/pull/267734","number":267734,"branch":"9.4","state":"OPEN"}]}]
BACKPORT-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:all-open Backport to all branches that could still receive a release chore dependencies Pull requests that update a dependency file release_note:skip Skip the PR/issue when compiling release notes v8.19.16 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