Skip to content

@apphosting/build@0.1.7 missing yaml in package.json dependencies #10508

@philemonkipngetich

Description

@philemonkipngetich

[REQUIRED] Environment info

firebase-tools: 15.17.0

Platform: Windows

[REQUIRED] Test case

Any project using Firebase Functions. Run:

firebase deploy --only functions

[REQUIRED] Steps to reproduce

  1. Install firebase-tools globally
  2. In any Firebase Functions project, run:
    firebase deploy --only functions --debug
  3. The CLI crashes immediately on startup before deployment even begins

[REQUIRED] Expected behavior

firebase deploy --only functions should execute successfully without module resolution errors.

[REQUIRED] Actual behavior

The CLI crashes immediately with:

Error: Cannot find module 'yaml'
Require stack:
- ...\node_modules\@apphosting\build\dist\index.js
- ...\node_modules\firebase-tools\lib\apphosting\localbuilds.js
- ...\node_modules\firebase-tools\lib\deploy\apphosting\prepare.js
- ...\node_modules\firebase-tools\lib\deploy\apphosting\index.js
- ...\node_modules\firebase-tools\lib\deploy\index.js
- ...\node_modules\firebase-tools\lib\commands\deploy.js
- ...\node_modules\firebase-tools\lib\commands\index.js
- ...\node_modules\firebase-tools\lib\index.js
- ...\node_modules\firebase-tools\lib\bin\cli.js
- ...\node_modules\firebase-tools\lib\bin\firebase.js

Error: An unexpected error has occurred.

Root cause:

@apphosting/build@0.1.7 calls require("yaml") in dist/index.js at line 13:

const yaml_1 = require("yaml");

However, yaml is not declared as a dependency in @apphosting/build's package.json. Its declared dependencies are only:

{
  "dependencies": {
    "@apphosting/common": "^0.0.9",
    "@npmcli/promise-spawn": "^3.0.0",
    "colorette": "^2.0.20",
    "commander": "^11.1.0",
    "npm-pick-manifest": "^9.0.0",
    "ts-node": "^10.9.1"
  }
}

yaml is a dependency of firebase-tools itself, and @apphosting/build currently only resolves it by accidentally inheriting it through firebase-tools's node_modules via hoisting. This is not guaranteed behavior per the Node.js module resolution specification.

Suggested fix:

Add yaml to @apphosting/build's dependencies in its package.json:

{
  "dependencies": {
    "yaml": "^2.0.0"
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions