fix: Push adapter not loading on some versions of Node 22 (#9525)

This commit is contained in:
Daniel
2025-01-12 12:10:35 +11:00
committed by GitHub
parent 4ac8aef940
commit 5447c222c8
2 changed files with 19 additions and 31 deletions

View File

@@ -8,7 +8,7 @@ on:
paths-ignore: paths-ignore:
- '**/**.md' - '**/**.md'
env: env:
NODE_VERSION: 22.4.1 NODE_VERSION: 22.12.0
PARSE_SERVER_TEST_TIMEOUT: 20000 PARSE_SERVER_TEST_TIMEOUT: 20000
permissions: permissions:
actions: write actions: write
@@ -145,32 +145,32 @@ jobs:
- name: MongoDB 4.2, ReplicaSet - name: MongoDB 4.2, ReplicaSet
MONGODB_VERSION: 4.2.25 MONGODB_VERSION: 4.2.25
MONGODB_TOPOLOGY: replset MONGODB_TOPOLOGY: replset
NODE_VERSION: 22.4.1 NODE_VERSION: 22.12.0
- name: MongoDB 4.4, ReplicaSet - name: MongoDB 4.4, ReplicaSet
MONGODB_VERSION: 4.4.29 MONGODB_VERSION: 4.4.29
MONGODB_TOPOLOGY: replset MONGODB_TOPOLOGY: replset
NODE_VERSION: 22.4.1 NODE_VERSION: 22.12.0
- name: MongoDB 5, ReplicaSet - name: MongoDB 5, ReplicaSet
MONGODB_VERSION: 5.0.26 MONGODB_VERSION: 5.0.26
MONGODB_TOPOLOGY: replset MONGODB_TOPOLOGY: replset
NODE_VERSION: 22.4.1 NODE_VERSION: 22.12.0
- name: MongoDB 6, ReplicaSet - name: MongoDB 6, ReplicaSet
MONGODB_VERSION: 6.0.14 MONGODB_VERSION: 6.0.14
MONGODB_TOPOLOGY: replset MONGODB_TOPOLOGY: replset
NODE_VERSION: 22.4.1 NODE_VERSION: 22.12.0
- name: MongoDB 7, ReplicaSet - name: MongoDB 7, ReplicaSet
MONGODB_VERSION: 7.0.8 MONGODB_VERSION: 7.0.8
MONGODB_TOPOLOGY: replset MONGODB_TOPOLOGY: replset
NODE_VERSION: 22.4.1 NODE_VERSION: 22.12.0
- name: MongoDB 8, ReplicaSet - name: MongoDB 8, ReplicaSet
MONGODB_VERSION: 8.0.0 MONGODB_VERSION: 8.0.0
MONGODB_TOPOLOGY: replset MONGODB_TOPOLOGY: replset
NODE_VERSION: 22.4.1 NODE_VERSION: 22.12.0
- name: Redis Cache - name: Redis Cache
PARSE_SERVER_TEST_CACHE: redis PARSE_SERVER_TEST_CACHE: redis
MONGODB_VERSION: 8.0.0 MONGODB_VERSION: 8.0.0
MONGODB_TOPOLOGY: standalone MONGODB_TOPOLOGY: standalone
NODE_VERSION: 22.4.1 NODE_VERSION: 22.12.0
- name: Node 20 - name: Node 20
MONGODB_VERSION: 8.0.0 MONGODB_VERSION: 8.0.0
MONGODB_TOPOLOGY: standalone MONGODB_TOPOLOGY: standalone
@@ -227,31 +227,31 @@ jobs:
include: include:
- name: PostgreSQL 13, PostGIS 3.1 - name: PostgreSQL 13, PostGIS 3.1
POSTGRES_IMAGE: postgis/postgis:13-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 - name: PostgreSQL 13, PostGIS 3.2
POSTGRES_IMAGE: postgis/postgis:13-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 - name: PostgreSQL 13, PostGIS 3.3
POSTGRES_IMAGE: postgis/postgis:13-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 - name: PostgreSQL 13, PostGIS 3.4
POSTGRES_IMAGE: postgis/postgis:13-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 - name: PostgreSQL 13, PostGIS 3.5
POSTGRES_IMAGE: postgis/postgis:13-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 - name: PostgreSQL 14, PostGIS 3.5
POSTGRES_IMAGE: postgis/postgis:14-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 - name: PostgreSQL 15, PostGIS 3.5
POSTGRES_IMAGE: postgis/postgis:15-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 - name: PostgreSQL 16, PostGIS 3.5
POSTGRES_IMAGE: postgis/postgis:16-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 - name: PostgreSQL 17, PostGIS 3.5
POSTGRES_IMAGE: postgis/postgis:17-3.5 POSTGRES_IMAGE: postgis/postgis:17-3.5
NODE_VERSION: 22.4.1 NODE_VERSION: 22.12.0
fail-fast: false fail-fast: false
name: ${{ matrix.name }} name: ${{ matrix.name }}
timeout-minutes: 20 timeout-minutes: 20

View File

@@ -47,20 +47,8 @@ export function loadAdapter<T>(adapter, defaultAdapter, options): T {
} }
export async function loadModule(modulePath) { export async function loadModule(modulePath) {
let module; const module = await import(modulePath);
try { return module?.default || module;
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;
} }
export default loadAdapter; export default loadAdapter;