Skip to content
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

fix: slow startup if no network is available #5055

Merged
merged 5 commits into from
Jan 31, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/deploy/functions/runtimes/node/versioning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import * as fs from "fs";
import * as path from "path";

import * as clc from "colorette";
import * as semver from "semver";
import * as spawn from "cross-spawn";
import * as semver from "semver";

import * as utils from "../../../../utils";
import { logger } from "../../../../logger";
import { track } from "../../../../track";
import * as utils from "../../../../utils";

interface NpmShowResult {
"dist-tags": {
Expand All @@ -16,6 +16,7 @@ interface NpmShowResult {
}

const MIN_SDK_VERSION = "2.0.0";
const NPM_COMMAND_TIMEOUT_MILLIES = 3000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed this internally and think that 10000 would be a more appropriate timeout for customers with slower connectivity or an intermittent issue

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@colerogers ok good point. I updated the value as per your recommendation


export const FUNCTIONS_SDK_VERSION_TOO_OLD_WARNING =
clc.bold(clc.yellow("functions: ")) +
Expand Down Expand Up @@ -88,6 +89,7 @@ export function getFunctionsSDKVersion(sourceDir: string): string | undefined {
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(
Expand Down