[HOTE-803] feat: Remove undici package#338
Merged
lewisbirks merged 13 commits intomainfrom Apr 13, 2026
Merged
Conversation
…ature/hote-803/update-npm-deps-new-features
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the lambdas/ package to use undici 8.x and adjusts the shared HTTP client wrapper to ensure Agent dispatchers remain compatible at runtime while preserving existing unit-test mocking behavior.
Changes:
- Bump
undicidependency from7.24.7to8.0.2inlambdas/. - Update
FetchHttpClientto route requests through an internaldoFetch()helper, usingundici’sfetchwhen a customAgentdispatcher is configured. - Regenerate
lambdas/package-lock.jsonto reflect the new dependency graph and engine requirements.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
lambdas/src/lib/http/http-client.ts |
Uses undici’s fetch when a custom Agent dispatcher is present; otherwise uses global fetch to keep existing Jest mocks working. |
lambdas/package.json |
Updates undici to 8.0.2. |
lambdas/package-lock.json |
Lockfile updates for undici@8.0.2 and transitive dependencies/engines. |
Files not reviewed (1)
- lambdas/package-lock.json: Language not supported
Contributor
|
@mikeeq one thing to check would be if we actually need |
19121b6 to
ced04d8
Compare
`undici` was added as a dependency solely to provide an `Agent` that could disable TLS certificate
verification (`rejectUnauthorized: false`) when making outbound HTTP requests via the native
`fetch` API. This was used in `FetchHttpClient` and surfaced through the
`POSTCODE_LOOKUP_REJECT_UNAUTHORIZED` environment variable on the postcode-lookup lambda.
Investigation showed the option served no purpose in any environment:
- **Locally**, the postcode lookup target (`POSTCODE_LOOKUP_BASE_URL`) resolves to WireMock over
plain HTTP (`http://wiremock:8080`), so TLS is never negotiated and `rejectUnauthorized` has no
effect.
- **In production**, the environment variable is absent, causing the expression
`retrieveOptionalEnvVariable("POSTCODE_LOOKUP_REJECT_UNAUTHORIZED") === "true"` to evaluate to
`false` — meaning TLS verification was silently disabled for every OS Places API call in
production.
The `undici` dependency, the `rejectUnauthorized` option on `FetchHttpClient`, the corresponding
fields on `PostcodeLookupClientConfig` and `PostcodeLookupEnvVariables`, and the Terraform env var
have all been removed. `FetchHttpClient` now uses the native `fetch` API directly with no
dispatcher override.
Signed-off-by: lewisbirks <lewis.birks1@nhs.net>
…te-npm-deps-new-features
|
lewisbirks
approved these changes
Apr 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Context
Type of changes
Checklist
Sensitive Information Declaration
To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including PII (Personal Identifiable Information) / PID (Personal Identifiable Data) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter.