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.
https://eaflood.atlassian.net/browse/WATER-4039
Phew! Somehow when looking into why there were errors during an import process we've ended up needing to upgrade Hapi!
In order to better debug issues with the NALD import process we wanted to add a new POST endpoint that would allow us to trigger it manually. But when we did we saw the request logged but nothing was actually firing. The handler would not be called and the request would not disconnect leaving Postman whirring away.
We quickly spotted
GET
requests were fine it was justPOST
failing. Hmm 🤔Some Googling later and we found we were not alone
It seems the root cause is running Hapi on Node v16 which we are doing in our local dev environment. In our AWS environments, we're running v14 but we intend to upgrade as soon as SROC supplementary billing is shipped.
So, we know this project is fine in AWS running v14 which concurs with those posts. But we also know apps like water-abstraction-service are handling
POST
requests fine in our local dev environment. The difference is the version of Hapi; they are running v21 but the import service is running v18.This change updates Hapi to v21 (and anything else needed along the way) in order to resolve this issue and get the project ready for upgrading all our environments to v16.
The upgrade from version 18->19 introduces a breaking change as per the v19 release notes hapijs/hapi#4017 - "No joi schema compiler is loaded by default and must be explicitly loaded".
This breaking change produces the error
error: AssertError: Cannot set uncompiled validation rules without configuring a validator
which is fixed by explicitly loading joi.Notes
@hapi/hapi
3 major versions@hapi/hapi
(The upgrade from version 18->19 introduces a breaking change "No joi schema compiler is loaded by default and must be explicitly loaded". This commit fixes that issue as per the v19 release notes: 19.0.0 Release Notes hapijs/hapi#4017)