chore(eventbroker): replace axios and related nock tests#20720
Open
toufali wants to merge 1 commit into
Open
Conversation
560e575 to
3d9c7a6
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes axios (and related nock-based tests) from the fxa-event-broker package, migrating the affected code paths to native fetch to reduce dependency/security advisory surface area.
Changes:
- Replaced
axiosusages withfetchin the pubsub proxy controller, client capability service, and the webhook simulation script. - Migrated tests from
nocktoglobal.fetchstubs, including coverage for non-OK HTTP responses. - Removed
axiosandnockfromfxa-event-brokerdependencies and simplified Jest config accordingly.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Removes axios/nock from the fxa-event-broker workspace dependency set. |
| packages/fxa-event-broker/src/scripts/simulate-webhook-call.ts | Switches webhook call simulation from axios to fetch. |
| packages/fxa-event-broker/src/pubsub-proxy/pubsub-proxy.controller.ts | Replaces axios proxying with fetch, adds JSON-with-text-fallback response parsing helper. |
| packages/fxa-event-broker/src/pubsub-proxy/pubsub-proxy.controller.spec.ts | Replaces nock HTTP mocking with global.fetch stubs and adds a non-OK response test. |
| packages/fxa-event-broker/src/client-capability/client-capability.service.ts | Replaces axios client capability fetch with fetch and explicit non-OK handling. |
| packages/fxa-event-broker/src/client-capability/client-capability.service.spec.ts | Updates tests to stub global.fetch and adds coverage for reject + non-OK paths. |
| packages/fxa-event-broker/package.json | Removes axios and nock dependencies from the package. |
| packages/fxa-event-broker/jest.config.js | Removes the special-case transform for axios. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Because
axiosis a recurring source of security advisories. This is the first step of removing it in favor of nativefetch(FXA-13427), starting with the self-containedfxa-event-brokerpackage.This pull request
axioswith nativefetchinClientCapabilityService,PubsubProxyController, and thesimulate-webhook-callscript. Behavior is preserved (explicit!res.okhandling, JSON-with-text-fallback body parsing).nockto a stubbedglobal.fetch, and adds coverage for the non-ok HTTP path.axiosandnockdependencies from the package.Issue that this pull request solves
Closes: FXA-13427 (event-broker package)
Checklist
Put an
xin the boxes that apply