diff --git a/src/deploy/functions/runtimes/node/versioning.ts b/src/deploy/functions/runtimes/node/versioning.ts index 93630ed2d73e..c0898629b832 100644 --- a/src/deploy/functions/runtimes/node/versioning.ts +++ b/src/deploy/functions/runtimes/node/versioning.ts @@ -25,6 +25,7 @@ interface NpmShowResult { } const MIN_SDK_VERSION = "2.0.0"; +const NPM_COMMAND_TIMEOUT_MILLIES = 3000; export const FUNCTIONS_SDK_VERSION_TOO_OLD_WARNING = clc.bold(clc.yellow("functions: ")) + @@ -45,6 +46,7 @@ export function getFunctionsSDKVersion(sourceDir: string): string | void { const child = spawn.sync("npm", ["list", "firebase-functions", "--json=true"], { cwd: sourceDir, encoding: "utf8", + timeout: NPM_COMMAND_TIMEOUT_MILLIES, }); if (child.error) { logger.debug("getFunctionsSDKVersion encountered error:", child.error.stack); @@ -61,6 +63,7 @@ export function getFunctionsSDKVersion(sourceDir: string): string | void { export function getLatestSDKVersion(): string | undefined { const child = spawn.sync("npm", ["show", "firebase-functions", "--json=true"], { encoding: "utf8", + timeout: NPM_COMMAND_TIMEOUT_MILLIES, }); if (child.error) { logger.debug(