Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Push adapter not loading on some versions of Node 22 #9524

Merged
merged 14 commits into from
Jan 11, 2025
34 changes: 17 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
paths-ignore:
- '**/**.md'
env:
NODE_VERSION: 22.4.1
NODE_VERSION: 22.12.0
PARSE_SERVER_TEST_TIMEOUT: 20000
permissions:
actions: write
Expand Down Expand Up @@ -145,32 +145,32 @@ jobs:
- name: MongoDB 4.2, ReplicaSet
MONGODB_VERSION: 4.2.25
MONGODB_TOPOLOGY: replset
NODE_VERSION: 22.4.1
NODE_VERSION: 22.12.0
- name: MongoDB 4.4, ReplicaSet
MONGODB_VERSION: 4.4.29
MONGODB_TOPOLOGY: replset
NODE_VERSION: 22.4.1
NODE_VERSION: 22.12.0
- name: MongoDB 5, ReplicaSet
MONGODB_VERSION: 5.0.26
MONGODB_TOPOLOGY: replset
NODE_VERSION: 22.4.1
NODE_VERSION: 22.12.0
- name: MongoDB 6, ReplicaSet
MONGODB_VERSION: 6.0.14
MONGODB_TOPOLOGY: replset
NODE_VERSION: 22.4.1
NODE_VERSION: 22.12.0
- name: MongoDB 7, ReplicaSet
MONGODB_VERSION: 7.0.8
MONGODB_TOPOLOGY: replset
NODE_VERSION: 22.4.1
NODE_VERSION: 22.12.0
- name: MongoDB 8, ReplicaSet
MONGODB_VERSION: 8.0.0
MONGODB_TOPOLOGY: replset
NODE_VERSION: 22.4.1
NODE_VERSION: 22.12.0
- name: Redis Cache
PARSE_SERVER_TEST_CACHE: redis
MONGODB_VERSION: 8.0.0
MONGODB_TOPOLOGY: standalone
NODE_VERSION: 22.4.1
NODE_VERSION: 22.12.0
- name: Node 20
MONGODB_VERSION: 8.0.0
MONGODB_TOPOLOGY: standalone
Expand Down Expand Up @@ -227,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.12.0
- name: PostgreSQL 13, PostGIS 3.2
POSTGRES_IMAGE: postgis/postgis:13-3.2
NODE_VERSION: 22.4.1
NODE_VERSION: 22.12.0
- name: PostgreSQL 13, PostGIS 3.3
POSTGRES_IMAGE: postgis/postgis:13-3.3
NODE_VERSION: 22.4.1
NODE_VERSION: 22.12.0
- name: PostgreSQL 13, PostGIS 3.4
POSTGRES_IMAGE: postgis/postgis:13-3.4
NODE_VERSION: 22.4.1
NODE_VERSION: 22.12.0
- name: PostgreSQL 13, PostGIS 3.5
POSTGRES_IMAGE: postgis/postgis:13-3.5
NODE_VERSION: 22.4.1
NODE_VERSION: 22.12.0
- name: PostgreSQL 14, PostGIS 3.5
POSTGRES_IMAGE: postgis/postgis:14-3.5
NODE_VERSION: 22.4.1
NODE_VERSION: 22.12.0
- name: PostgreSQL 15, PostGIS 3.5
POSTGRES_IMAGE: postgis/postgis:15-3.5
NODE_VERSION: 22.4.1
NODE_VERSION: 22.12.0
- name: PostgreSQL 16, PostGIS 3.5
POSTGRES_IMAGE: postgis/postgis:16-3.5
NODE_VERSION: 22.4.1
NODE_VERSION: 22.12.0
- name: PostgreSQL 17, PostGIS 3.5
POSTGRES_IMAGE: postgis/postgis:17-3.5
NODE_VERSION: 22.4.1
NODE_VERSION: 22.12.0
fail-fast: false
name: ${{ matrix.name }}
timeout-minutes: 20
Expand Down
8 changes: 4 additions & 4 deletions spec/CLI.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,18 +219,18 @@ describe('execution', () => {
});
}

function handleStderr(childProcess, done) {
dblythy marked this conversation as resolved.
Show resolved Hide resolved
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;
});
}

Expand Down
16 changes: 4 additions & 12 deletions src/Adapters/AdapterLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,11 @@ export function loadAdapter<T>(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);
if (module.default) {
module = module.default;
}
} else {
throw err;
}
const module = await import(modulePath);
if (module.default) {
return module.default;
}

return module;
}

Expand Down
Loading