Skip to content

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

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

Merged
merged 14 commits into from
Jan 11, 2025
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions src/Adapters/AdapterLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions src/Controllers/AdaptableController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
Loading