Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove node-fetch #11266

Draft
wants to merge 116 commits into
base: latest
Choose a base branch
from
Draft

Conversation

amoore108
Copy link
Contributor

@amoore108 amoore108 commented Jan 8, 2024

Reverts #11261 and reinstates the original PR: #11122

Description from original PR:

Overall changes

Removes node-fetch and isomorphic-fetch in favour of using Node 18+ built-in fetch mechanism, provided by undici. Removes the need to do #9611

undici has been added as a dependency as we need its Agent constructor to use our custom certs to authenticate requests.

This aligns the Express and Next.js app to use the same fetch mechanism across both apps, and removes the need to keep node-fetch updated through its transition to ESM.

Code changes

  • Remove node-fetch and isomorphic-fetch and the instances these libraries were imported
  • Consolidate the getAgent function across the Express and Next.js apps
  • Mock Agent and getAgent in tests
  • Refactors the Live page fetch to be more inline with other fetchers that use fetchDataFromBFF

Testing

  1. Pull down this branch locally
  2. Run yarn to install the new dependencies
  3. Run yarn dev
  4. Visit a url with the renderer_env=live flag to ensure it fetches Live data with the certs
  5. Confirm the page loads as expected
  6. Repeat the steps for the Next.js app

@amoore108 amoore108 self-assigned this Jan 8, 2024
@amoore108 amoore108 changed the title [DNM] Revert "Revert "Remove node-fetch"" [DNM] Remove node-fetch Feb 9, 2024
@amoore108 amoore108 changed the title [DNM] Remove node-fetch Remove node-fetch Jun 20, 2024
Copy link
Contributor

@andrewscfc andrewscfc left a comment

Choose a reason for hiding this comment

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

Nice work, hope this works for Opera ⭕

src/app/routes/utils/certsRequired/index.ts Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants