From d97d54362121f5bd939292eec403a0adc6b152b8 Mon Sep 17 00:00:00 2001 From: Csaky Date: Fri, 29 Sep 2023 11:13:36 -0700 Subject: [PATCH 1/2] Remove request timeouts for upload endpoints Signed-off-by: Jeremy Ho --- app/src/middleware/upload.js | 8 ++++++++ app/tests/unit/middleware/upload.spec.js | 10 ++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) 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(); + } }); }); From 0822accd026a7ee6eff765ceb4e15cb133d2ba9d Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Fri, 6 Oct 2023 14:29:01 -0700 Subject: [PATCH 2/2] Add team member to codeowners Signed-off-by: Jeremy Ho --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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