Skip to content

Commit d47355d

Browse files
committed
Fail gracefully if the buildInfo command fails
1 parent 368dc92 commit d47355d

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

packages/mongodb-build-info/src/index.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,15 @@ export async function identifyServerName(
161161
return 'firestore';
162162
}
163163

164-
const buildInfo = await runCommand({ buildInfo: 1 });
164+
try {
165+
const buildInfo = await adminCommand({ buildInfo: 1 });
165166

166-
if ('ferretdb' in buildInfo) {
167-
return 'ferretdb';
167+
if ('ferretdb' in buildInfo) {
168+
return 'ferretdb';
169+
}
170+
} catch (error) {
171+
debug('buildInfo command failed %O', error);
172+
return 'unknown';
168173
}
169174

170175
try {

0 commit comments

Comments
 (0)