diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 193416b1..cd857725 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,4 +1,4 @@ # These users will be the default owners for everything in the repo. # Unless a later match takes precedence, the following users will be # requested for review when someone opens a pull request. -* @jujaga @norrisng-bc @TimCsaky +* @jujaga @norrisng-bc @TimCsaky @jatindersingh93 diff --git a/app/src/middleware/upload.js b/app/src/middleware/upload.js index 0c052d30..2fed8787 100644 --- a/app/src/middleware/upload.js +++ b/app/src/middleware/upload.js @@ -52,6 +52,14 @@ const currentUpload = (strict = false) => { mimeType: mimeType }); + /** + * Removes the default 5 minute request timeout added in Node v18 + * This change reverts the behavior to be similar to Node v16 and earlier + * This value should not be 0x7FFFFFFF as behavior becomes unpredictable + * @see {@link https://nodejs.org/en/blog/release/v18.0.0#http-timeouts} + */ + req.socket.server.requestTimeout = 0; + next(); }; }; diff --git a/app/tests/unit/middleware/upload.spec.js b/app/tests/unit/middleware/upload.spec.js index 8af29685..7419b98f 100644 --- a/app/tests/unit/middleware/upload.spec.js +++ b/app/tests/unit/middleware/upload.spec.js @@ -12,7 +12,10 @@ describe('currentUpload', () => { let req, res, next; beforeEach(() => { - req = { get: jest.fn() }; + req = { + get: jest.fn(), + socket: { server: {} } + }; res = {}; next = jest.fn(); }); @@ -52,7 +55,10 @@ describe('currentUpload', () => { expect(req.currentUpload).toEqual(current); expect(next).toHaveBeenCalledTimes(nextCount); - if (nextCount) expect(next).toHaveBeenCalledWith(); + if (nextCount) { + expect(req.socket.server.requestTimeout).toEqual(0); + expect(next).toHaveBeenCalledWith(); + } }); });