Skip to content

fix: make App Hosting emulator startup and configuration errors non-blocking - #10951

Open
christhompsongoogle wants to merge 1 commit into
mainfrom
fix/apphosting-emulator-startup
Open

fix: make App Hosting emulator startup and configuration errors non-blocking#10951
christhompsongoogle wants to merge 1 commit into
mainfrom
fix/apphosting-emulator-startup

Conversation

@christhompsongoogle

Copy link
Copy Markdown
Contributor

Description

Prevent missing configurations and startup failures for the App Hosting emulator from crashing emulators:start and blocking the rest of the emulator suite:

  • Check for package manager lockfiles (package-lock.json, yarn.lock, pnpm-lock.yaml) in shouldStart when startCommand is unconfigured, skipping startup with an error log if none are found.
  • Gracefully handle App Hosting emulator startup failure in startAll by cleaning up the failed instance and logging the error without crashing other emulators.

Fixes b/546204399

Scenarios Tested

  • Unit tests in controller.spec.ts for App Hosting shouldStart handling (missing lockfile, startCommand configured, and lockfile present).

Sample Commands

  • firebase init emulators (select all emulators)
  • firebase emulators:start

…locking

### Description
Prevent missing configurations and startup failures for the App Hosting emulator from crashing emulators:start and blocking the rest of the emulator suite:
- Check for package manager lockfiles (package-lock.json, yarn.lock, pnpm-lock.yaml) in shouldStart when startCommand is unconfigured, skipping startup with an error log if none are found.
- Gracefully handle App Hosting emulator startup failure in startAll by cleaning up the failed instance and logging the error without crashing other emulators.

Fixes b/546204399

### Scenarios Tested
- Unit tests in controller.spec.ts for App Hosting shouldStart handling (missing lockfile, startCommand configured, and lockfile present).

### Sample Commands
- firebase init emulators (select all emulators)
- firebase emulators:start
@google-cla

google-cla Bot commented Aug 18, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces graceful handling of App Hosting emulator startup failures and auto-detection of start commands from lockfiles (such as package-lock.json, yarn.lock, or pnpm-lock.yaml) when no explicit start command is configured. This prevents startup failures from blocking other emulators. The review feedback suggests improving the unit tests by configuring the fs.existsSync stub to fall back to its original implementation for non-matching arguments to avoid potential side effects during test execution.

Comment on lines +126 to +127
const existsStub = sinon.stub(fs, "existsSync");
existsStub.withArgs(sinon.match(/package-lock\.json/)).returns(true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Stubbing a global/module-level method like fs.existsSync without a fallback can cause unexpected side effects or break other unstubbed calls during test execution. It is safer to configure the stub to fall back to the original implementation for non-matching arguments.

      const existsStub = sinon.stub(fs, "existsSync");
      existsStub.callsFake(existsStub.wrappedMethod);
      existsStub.withArgs(sinon.match(/package-lock\.json/)).returns(true);

@wiz-9635d3485b

Copy link
Copy Markdown

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities -
Data Finding Sensitive Data -
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations -
SAST Finding SAST Findings 5 Medium 3 Low
Software Management Finding Software Management Findings -
Total 5 Medium 3 Low

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try the Wiz Code extension for VS Code, JetBrains, or Visual Studio.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants