Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
- Updated the functions.config deprecation notice from March 2026 to March 2027 (#9941)
- Detects when App Hosting fails to deploy, returning an error. (#8866)
10 changes: 9 additions & 1 deletion src/deploy/apphosting/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
logLabeledWarning,
} from "../../utils";
import { Context } from "./args";
import { FirebaseError } from "../../error";
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

To enable more robust error message handling later in the file, please also import getErrMsg here.

Suggested change
import { FirebaseError } from "../../error";
import { FirebaseError, getErrMsg } from "../../error";


/**
* Orchestrates rollouts for the backends targeted for deployment.
Expand Down Expand Up @@ -70,16 +71,23 @@
`Starting rollout(s) for backend(s) ${backendIds.join(", ")}; this may take a few minutes. It's safe to exit now.\n`,
).start();
const results = await Promise.allSettled(rollouts);
let failed = false;
for (let i = 0; i < results.length; i++) {
const res = results[i];
if (res.status === "fulfilled") {
const backend = await getBackend(projectId, backendIds[i]);
logLabeledSuccess("apphosting", `Rollout for backend ${backendIds[i]} complete!`);
logLabeledSuccess("apphosting", `Your backend is now deployed at:\n\thttps://${backend.uri}`);
} else {
failed = true;
logLabeledWarning("apphosting", `Rollout for backend ${backendIds[i]} failed.`);
logLabeledError("apphosting", res.reason);
logLabeledError("apphosting", `${res.reason}`);

Check warning on line 84 in src/deploy/apphosting/release.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Invalid type "any" of template literal expression
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Using getErrMsg provides more robust error message extraction from the unknown type res.reason. It correctly handles Error objects, strings, and other types, preventing potential output like [object Object]. This also aligns with our best practice of not using escape hatches for unknown types.

Suggested change
logLabeledError("apphosting", `${res.reason}`);
logLabeledError("apphosting", getErrMsg(res.reason));
References
  1. The style guide recommends against using escape hatches for any or unknown types and instead using proper interfaces, types, or type guards. Using getErrMsg is a better way to handle the unknown error reason. (link)

}
}
rolloutsSpinner.stop();
if (failed) {
throw new FirebaseError(
"One or more rollouts failed. Please review the errors above and try again.",
);
}
}
Loading