Skip to content
Latchkey

Firebase functions "engines field ... not supported" (Node version) in CI

The functions runtime is chosen from the engines.node field in functions/package.json. If that field is missing, or names a Node version the platform no longer supports, the deploy is rejected.

What this error means

A functions deploy fails complaining the engines field is missing, or that the requested Node runtime (for example nodejs14) is no longer supported.

firebase
Error: package.json in functions directory has an engines field which is unsupported. Valid choices are: {"node": "18|20|22"}

Common causes

A deprecated Node runtime

Older runtimes such as nodejs14 are decommissioned; a deploy targeting them is refused.

A missing engines field

Without engines.node, the CLI cannot choose a runtime and asks you to set one.

How to fix it

Set a supported Node version

  1. Set engines.node to a supported major version.
  2. Match the CI Node version to the same major so the build matches the runtime.
  3. Re-run the deploy.
functions/package.json
{
  "engines": { "node": "20" }
}

Pin the CI Node to match

Use the same Node major in CI so compiled output targets the deployed runtime.

.github/workflows/ci.yml
- uses: actions/setup-node@v4
  with:
    node-version: '20'

How to prevent it

  • Keep engines.node on a supported major version.
  • Match the CI Node version to the functions runtime.
  • Upgrade off decommissioned runtimes before they are removed.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →