From e50de4dd3157aea28655fee299378884fcfc20f9 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 10 Jan 2025 11:32:08 +1100 Subject: [PATCH 01/12] fix: invalid push adapter type --- src/Controllers/AdaptableController.js | 1 + src/Controllers/index.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Controllers/AdaptableController.js b/src/Controllers/AdaptableController.js index 15551a6e38..0d5c30be94 100644 --- a/src/Controllers/AdaptableController.js +++ b/src/Controllers/AdaptableController.js @@ -60,6 +60,7 @@ export class AdaptableController { }, {}); if (Object.keys(mismatches).length > 0) { + console.error("Adapter prototype don't match expected prototype", mismatches); throw new Error("Adapter prototype don't match expected prototype", adapter, mismatches); } } diff --git a/src/Controllers/index.js b/src/Controllers/index.js index abf0950640..f13b6dba51 100644 --- a/src/Controllers/index.js +++ b/src/Controllers/index.js @@ -182,7 +182,7 @@ export async function getPushController(options: ParseServerOptions): PushContro const ParsePushAdapter = await loadModule('@parse/push-adapter'); const pushAdapter = loadAdapter( pushOptions && pushOptions.adapter, - ParsePushAdapter, + ParsePushAdapter.default, pushOptions ); // We pass the options and the base class for the adatper, From d5498cd7f381594d88886d2518b90f5ce61dd031 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 10 Jan 2025 11:57:06 +1100 Subject: [PATCH 02/12] add node 22 matrix --- .github/workflows/ci.yml | 4 ++++ src/Controllers/index.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ea18c7244..ffebe4229d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -171,6 +171,10 @@ jobs: MONGODB_VERSION: 8.0.0 MONGODB_TOPOLOGY: standalone NODE_VERSION: 22.4.1 + - name: Node 22 + MONGODB_VERSION: 8.0.0 + MONGODB_TOPOLOGY: standalone + NODE_VERSION: 22.13.0 - name: Node 20 MONGODB_VERSION: 8.0.0 MONGODB_TOPOLOGY: standalone diff --git a/src/Controllers/index.js b/src/Controllers/index.js index f13b6dba51..abf0950640 100644 --- a/src/Controllers/index.js +++ b/src/Controllers/index.js @@ -182,7 +182,7 @@ export async function getPushController(options: ParseServerOptions): PushContro const ParsePushAdapter = await loadModule('@parse/push-adapter'); const pushAdapter = loadAdapter( pushOptions && pushOptions.adapter, - ParsePushAdapter.default, + ParsePushAdapter, pushOptions ); // We pass the options and the base class for the adatper, From 2b2395288b44f7afefd2942537f0f888b77c2fbb Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 10 Jan 2025 12:09:04 +1100 Subject: [PATCH 03/12] Update AdapterLoader.js --- src/Adapters/AdapterLoader.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Adapters/AdapterLoader.js b/src/Adapters/AdapterLoader.js index 5d9d9b0332..0b69c3601a 100644 --- a/src/Adapters/AdapterLoader.js +++ b/src/Adapters/AdapterLoader.js @@ -53,13 +53,15 @@ export async function loadModule(modulePath) { } catch (err) { if (err.code === 'ERR_REQUIRE_ESM') { module = await import(modulePath); - if (module.default) { - module = module.default; - } } else { throw err; } } + + if (module.default) { + module = module.default; + } + return module; } From 1eb2780fe8e4ceca2ce3984b426a0fff0a9276cc Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 10 Jan 2025 12:36:56 +1100 Subject: [PATCH 04/12] Update AdaptableController.js --- src/Controllers/AdaptableController.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Controllers/AdaptableController.js b/src/Controllers/AdaptableController.js index 0d5c30be94..15551a6e38 100644 --- a/src/Controllers/AdaptableController.js +++ b/src/Controllers/AdaptableController.js @@ -60,7 +60,6 @@ export class AdaptableController { }, {}); if (Object.keys(mismatches).length > 0) { - console.error("Adapter prototype don't match expected prototype", mismatches); throw new Error("Adapter prototype don't match expected prototype", adapter, mismatches); } } From 63aed578efaa7e2c4c2a093ee4fad16dd17adfa9 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 10 Jan 2025 11:32:08 +1100 Subject: [PATCH 05/12] fix: Push adapter not loading on Node 22 --- .github/workflows/ci.yml | 4 ++++ src/Adapters/AdapterLoader.js | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ea18c7244..ffebe4229d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -171,6 +171,10 @@ jobs: MONGODB_VERSION: 8.0.0 MONGODB_TOPOLOGY: standalone NODE_VERSION: 22.4.1 + - name: Node 22 + MONGODB_VERSION: 8.0.0 + MONGODB_TOPOLOGY: standalone + NODE_VERSION: 22.13.0 - name: Node 20 MONGODB_VERSION: 8.0.0 MONGODB_TOPOLOGY: standalone diff --git a/src/Adapters/AdapterLoader.js b/src/Adapters/AdapterLoader.js index 5d9d9b0332..0b69c3601a 100644 --- a/src/Adapters/AdapterLoader.js +++ b/src/Adapters/AdapterLoader.js @@ -53,13 +53,15 @@ export async function loadModule(modulePath) { } catch (err) { if (err.code === 'ERR_REQUIRE_ESM') { module = await import(modulePath); - if (module.default) { - module = module.default; - } } else { throw err; } } + + if (module.default) { + module = module.default; + } + return module; } From 7ac206422ceb5c40e17fa42c6e5e51dfcc53b115 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 10 Jan 2025 13:11:09 +1100 Subject: [PATCH 06/12] Update ci.yml --- .github/workflows/ci.yml | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ffebe4229d..786fa35616 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ on: paths-ignore: - '**/**.md' env: - NODE_VERSION: 22.4.1 + NODE_VERSION: 22.13.0 PARSE_SERVER_TEST_TIMEOUT: 20000 permissions: actions: write @@ -145,33 +145,29 @@ jobs: - name: MongoDB 4.2, ReplicaSet MONGODB_VERSION: 4.2.25 MONGODB_TOPOLOGY: replset - NODE_VERSION: 22.4.1 + NODE_VERSION: 22.13.0 - name: MongoDB 4.4, ReplicaSet MONGODB_VERSION: 4.4.29 MONGODB_TOPOLOGY: replset - NODE_VERSION: 22.4.1 + NODE_VERSION: 22.13.0 - name: MongoDB 5, ReplicaSet MONGODB_VERSION: 5.0.26 MONGODB_TOPOLOGY: replset - NODE_VERSION: 22.4.1 + NODE_VERSION: 22.13.0 - name: MongoDB 6, ReplicaSet MONGODB_VERSION: 6.0.14 MONGODB_TOPOLOGY: replset - NODE_VERSION: 22.4.1 + NODE_VERSION: 22.13.0 - name: MongoDB 7, ReplicaSet MONGODB_VERSION: 7.0.8 MONGODB_TOPOLOGY: replset - NODE_VERSION: 22.4.1 + NODE_VERSION: 22.13.0 - name: MongoDB 8, ReplicaSet MONGODB_VERSION: 8.0.0 MONGODB_TOPOLOGY: replset - NODE_VERSION: 22.4.1 + NODE_VERSION: 22.13.0 - name: Redis Cache PARSE_SERVER_TEST_CACHE: redis - MONGODB_VERSION: 8.0.0 - MONGODB_TOPOLOGY: standalone - NODE_VERSION: 22.4.1 - - name: Node 22 MONGODB_VERSION: 8.0.0 MONGODB_TOPOLOGY: standalone NODE_VERSION: 22.13.0 @@ -231,31 +227,31 @@ jobs: include: - name: PostgreSQL 13, PostGIS 3.1 POSTGRES_IMAGE: postgis/postgis:13-3.1 - NODE_VERSION: 22.4.1 + NODE_VERSION: 22.13.0 - name: PostgreSQL 13, PostGIS 3.2 POSTGRES_IMAGE: postgis/postgis:13-3.2 - NODE_VERSION: 22.4.1 + NODE_VERSION: 22.13.0 - name: PostgreSQL 13, PostGIS 3.3 POSTGRES_IMAGE: postgis/postgis:13-3.3 - NODE_VERSION: 22.4.1 + NODE_VERSION: 22.13.0 - name: PostgreSQL 13, PostGIS 3.4 POSTGRES_IMAGE: postgis/postgis:13-3.4 - NODE_VERSION: 22.4.1 + NODE_VERSION: 22.13.0 - name: PostgreSQL 13, PostGIS 3.5 POSTGRES_IMAGE: postgis/postgis:13-3.5 - NODE_VERSION: 22.4.1 + NODE_VERSION: 22.13.0 - name: PostgreSQL 14, PostGIS 3.5 POSTGRES_IMAGE: postgis/postgis:14-3.5 - NODE_VERSION: 22.4.1 + NODE_VERSION: 22.13.0 - name: PostgreSQL 15, PostGIS 3.5 POSTGRES_IMAGE: postgis/postgis:15-3.5 - NODE_VERSION: 22.4.1 + NODE_VERSION: 22.13.0 - name: PostgreSQL 16, PostGIS 3.5 POSTGRES_IMAGE: postgis/postgis:16-3.5 - NODE_VERSION: 22.4.1 + NODE_VERSION: 22.13.0 - name: PostgreSQL 17, PostGIS 3.5 POSTGRES_IMAGE: postgis/postgis:17-3.5 - NODE_VERSION: 22.4.1 + NODE_VERSION: 22.13.0 fail-fast: false name: ${{ matrix.name }} timeout-minutes: 20 From a36bf8779d5d64b21ba206ec96b2c4a1bca9880b Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 10 Jan 2025 13:22:12 +1100 Subject: [PATCH 07/12] Update ci.yml --- .github/workflows/ci.yml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 786fa35616..b8fcbb4b86 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ on: paths-ignore: - '**/**.md' env: - NODE_VERSION: 22.13.0 + NODE_VERSION: 22.12.0 PARSE_SERVER_TEST_TIMEOUT: 20000 permissions: actions: write @@ -145,32 +145,32 @@ jobs: - name: MongoDB 4.2, ReplicaSet MONGODB_VERSION: 4.2.25 MONGODB_TOPOLOGY: replset - NODE_VERSION: 22.13.0 + NODE_VERSION: 22.12.0 - name: MongoDB 4.4, ReplicaSet MONGODB_VERSION: 4.4.29 MONGODB_TOPOLOGY: replset - NODE_VERSION: 22.13.0 + NODE_VERSION: 22.12.0 - name: MongoDB 5, ReplicaSet MONGODB_VERSION: 5.0.26 MONGODB_TOPOLOGY: replset - NODE_VERSION: 22.13.0 + NODE_VERSION: 22.12.0 - name: MongoDB 6, ReplicaSet MONGODB_VERSION: 6.0.14 MONGODB_TOPOLOGY: replset - NODE_VERSION: 22.13.0 + NODE_VERSION: 22.12.0 - name: MongoDB 7, ReplicaSet MONGODB_VERSION: 7.0.8 MONGODB_TOPOLOGY: replset - NODE_VERSION: 22.13.0 + NODE_VERSION: 22.12.0 - name: MongoDB 8, ReplicaSet MONGODB_VERSION: 8.0.0 MONGODB_TOPOLOGY: replset - NODE_VERSION: 22.13.0 + NODE_VERSION: 22.12.0 - name: Redis Cache PARSE_SERVER_TEST_CACHE: redis MONGODB_VERSION: 8.0.0 MONGODB_TOPOLOGY: standalone - NODE_VERSION: 22.13.0 + NODE_VERSION: 22.12.0 - name: Node 20 MONGODB_VERSION: 8.0.0 MONGODB_TOPOLOGY: standalone @@ -227,31 +227,31 @@ jobs: include: - name: PostgreSQL 13, PostGIS 3.1 POSTGRES_IMAGE: postgis/postgis:13-3.1 - NODE_VERSION: 22.13.0 + NODE_VERSION: 22.12.0 - name: PostgreSQL 13, PostGIS 3.2 POSTGRES_IMAGE: postgis/postgis:13-3.2 - NODE_VERSION: 22.13.0 + NODE_VERSION: 22.12.0 - name: PostgreSQL 13, PostGIS 3.3 POSTGRES_IMAGE: postgis/postgis:13-3.3 - NODE_VERSION: 22.13.0 + NODE_VERSION: 22.12.0 - name: PostgreSQL 13, PostGIS 3.4 POSTGRES_IMAGE: postgis/postgis:13-3.4 - NODE_VERSION: 22.13.0 + NODE_VERSION: 22.12.0 - name: PostgreSQL 13, PostGIS 3.5 POSTGRES_IMAGE: postgis/postgis:13-3.5 - NODE_VERSION: 22.13.0 + NODE_VERSION: 22.12.0 - name: PostgreSQL 14, PostGIS 3.5 POSTGRES_IMAGE: postgis/postgis:14-3.5 - NODE_VERSION: 22.13.0 + NODE_VERSION: 22.12.0 - name: PostgreSQL 15, PostGIS 3.5 POSTGRES_IMAGE: postgis/postgis:15-3.5 - NODE_VERSION: 22.13.0 + NODE_VERSION: 22.12.0 - name: PostgreSQL 16, PostGIS 3.5 POSTGRES_IMAGE: postgis/postgis:16-3.5 - NODE_VERSION: 22.13.0 + NODE_VERSION: 22.12.0 - name: PostgreSQL 17, PostGIS 3.5 POSTGRES_IMAGE: postgis/postgis:17-3.5 - NODE_VERSION: 22.13.0 + NODE_VERSION: 22.12.0 fail-fast: false name: ${{ matrix.name }} timeout-minutes: 20 From 6f8be9ecaceee69b996ea2f0d742419f3231c6b0 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 10 Jan 2025 13:39:01 +1100 Subject: [PATCH 08/12] Update CLI.spec.js --- spec/CLI.spec.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/CLI.spec.js b/spec/CLI.spec.js index f78b542e52..a37409da23 100644 --- a/spec/CLI.spec.js +++ b/spec/CLI.spec.js @@ -219,18 +219,18 @@ describe('execution', () => { }); } - function handleStderr(childProcess, done) { + function handleStderr(childProcess) { childProcess.stderr.on('data', data => { data = data.toString(); if (!data.includes('[DEP0040] DeprecationWarning')) { - done.fail(data); + throw data; } }); } - function handleError(childProcess, done) { + function handleError(childProcess) { childProcess.on('error', err => { - done.fail(err); + throw err; }); } From 585d91be8463e67fdc10d7b850907fd68c50bc0e Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 10 Jan 2025 14:04:54 +1100 Subject: [PATCH 09/12] Update AdapterLoader.js --- src/Adapters/AdapterLoader.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/Adapters/AdapterLoader.js b/src/Adapters/AdapterLoader.js index 0b69c3601a..2beec4a4bd 100644 --- a/src/Adapters/AdapterLoader.js +++ b/src/Adapters/AdapterLoader.js @@ -47,17 +47,7 @@ export function loadAdapter(adapter, defaultAdapter, options): T { } export async function loadModule(modulePath) { - let module; - try { - module = require(modulePath); - } catch (err) { - if (err.code === 'ERR_REQUIRE_ESM') { - module = await import(modulePath); - } else { - throw err; - } - } - + let module = await import(modulePath); if (module.default) { module = module.default; } From b92cec6fdaaab19e8e932c05a83231137f569841 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 10 Jan 2025 14:05:14 +1100 Subject: [PATCH 10/12] Update AdapterLoader.js --- src/Adapters/AdapterLoader.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Adapters/AdapterLoader.js b/src/Adapters/AdapterLoader.js index 2beec4a4bd..0ef288641b 100644 --- a/src/Adapters/AdapterLoader.js +++ b/src/Adapters/AdapterLoader.js @@ -47,9 +47,9 @@ export function loadAdapter(adapter, defaultAdapter, options): T { } export async function loadModule(modulePath) { - let module = await import(modulePath); + const module = await import(modulePath); if (module.default) { - module = module.default; + return module.default; } return module; From fac1a12443a69c08e9595dc06efdf94254e90fcb Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 10 Jan 2025 16:09:57 +1100 Subject: [PATCH 11/12] Update CLI.spec.js --- spec/CLI.spec.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/CLI.spec.js b/spec/CLI.spec.js index a37409da23..f78b542e52 100644 --- a/spec/CLI.spec.js +++ b/spec/CLI.spec.js @@ -219,18 +219,18 @@ describe('execution', () => { }); } - function handleStderr(childProcess) { + function handleStderr(childProcess, done) { childProcess.stderr.on('data', data => { data = data.toString(); if (!data.includes('[DEP0040] DeprecationWarning')) { - throw data; + done.fail(data); } }); } - function handleError(childProcess) { + function handleError(childProcess, done) { childProcess.on('error', err => { - throw err; + done.fail(err); }); } From 6930f8f6488cf02f5aba0c0695c833014619984e Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 10 Jan 2025 16:10:57 +1100 Subject: [PATCH 12/12] Update AdapterLoader.js --- src/Adapters/AdapterLoader.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Adapters/AdapterLoader.js b/src/Adapters/AdapterLoader.js index 0ef288641b..aa40162cd0 100644 --- a/src/Adapters/AdapterLoader.js +++ b/src/Adapters/AdapterLoader.js @@ -48,11 +48,7 @@ export function loadAdapter(adapter, defaultAdapter, options): T { export async function loadModule(modulePath) { const module = await import(modulePath); - if (module.default) { - return module.default; - } - - return module; + return module?.default || module; } export default loadAdapter;