Skip to content

Commit

Permalink
fix: Push adapter not loading on some versions of Node 22 (#9525)
Browse files Browse the repository at this point in the history
  • Loading branch information
dblythy authored Jan 12, 2025
1 parent 4ac8aef commit 5447c22
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 31 deletions.
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
16 changes: 2 additions & 14 deletions src/Adapters/AdapterLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,8 @@ 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;
}
}
return module;
const module = await import(modulePath);
return module?.default || module;
}

export default loadAdapter;

0 comments on commit 5447c22

Please sign in to comment.