Skip to content

Commit

Permalink
Workaround for #7165
Browse files Browse the repository at this point in the history
  • Loading branch information
inlined committed May 13, 2024
1 parent 8748b80 commit 157b2f6
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/deploy/functions/runtimes/discovery/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { FirebaseError } from "../../../../error";

export const readFileAsync = promisify(fs.readFile);

const TIMEOUT_OVERRIDE_ENV_VAR = "FUNCTIONS_DISCOVERY_TIMEOUT";

/**
* Converts the YAML retrieved from discovery into a Build object for param interpolation.
*/
Expand Down Expand Up @@ -73,9 +75,14 @@ export async function detectFromPort(
): Promise<build.Build> {
let res: Response;
const timedOut = new Promise<never>((resolve, reject) => {
setTimeout(() => {
reject(new FirebaseError("User code failed to load. Cannot determine backend specification"));
}, timeout);
setTimeout(
() => {
reject(
new FirebaseError("User code failed to load. Cannot determine backend specification"),
);
},
+(process.env[TIMEOUT_OVERRIDE_ENV_VAR] || 0) || timeout,
);
});

while (true) {
Expand Down

0 comments on commit 157b2f6

Please sign in to comment.