Closed baltpeter closed 1 year ago
A POST request causes the following error, which crashes the server (in prod, it is then automatically restarted by pm2):
An unhandled promise rejection occurred: TypeError: Cannot read properties of null (reading 'statusCode')
at Request._finalize (/home/benni/coding/git-repos/Datenanfragen.de/backend/node_modules/@hapi/hapi/lib/request.js:491:31)
at Request._reply (/home/benni/coding/git-repos/Datenanfragen.de/backend/node_modules/@hapi/hapi/lib/request.js:428:18)
at Request._execute (/home/benni/coding/git-repos/Datenanfragen.de/backend/node_modules/@hapi/hapi/lib/request.js:274:14)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Unless I'm missing something, this isn't a problem in our code (the stack trace is entirely in node_modules
and our code doesn't contain statusCode
anywhere). And since this used to work, I guess the best course of action is to try and update hapi and the associated libraries in the hope that whatever the problem is was fixed upstream.
Updating hapi has solved the problem locally. Not much in the way of breaking changes, either. Only had to change imports from @hapi/joi
to joi
.
While I'm at it, I'll also update everything else.
We can't update to nanoid v4 yet since that removes CJS support (https://github.com/ai/nanoid/blob/950dbdaefef465cc6925c6ec596b3478233a1c2d/CHANGELOG.md#40). I'll update to the latest 3.x version.
See https://github.com/datenanfragen/website/issues/1060 and https://github.com/datenanfragen/website/issues/1062.