firebase-tools: `Build failed: parsing npm version: Invalid Semantic Version; Error ID: f113d9b7` when trying to deploy functions

[REQUIRED] Environment info

firebase-tools: v12.2.1

Platform: Ubuntu (Github actions machine Ubuntu 22.04 with npm 9.5.1)

  node: v18.16.0
  npm: 9.5.1

[REQUIRED] Test case

N/A, this happens when trying to deploy functions that could previously be deployed without issues for a lot of times. I have not seen this error before.

[REQUIRED] Steps to reproduce

Execute firebase deploy --project=default --only functions:myFunction

[REQUIRED] Expected behavior

Existing v1 Function is updated correctly.

[REQUIRED] Actual behavior

The following output is logged:

...
i  functions: updating Node.js 18 (1st Gen) function myFunction(europe-west3)...
Build failed: parsing npm version: Invalid Semantic Version; Error ID: f113d9b7

Functions deploy had errors with the following functions:
      myFunction(europe-west3)
i  functions: cleaning up build files...
Error: There was an error deploying functions:
- Error Failed to update function myFunction in region europe-west3
Error: Process completed with exit code 2.

Unfortunately, I cannot find anything when searching for this error (id), it looks more like a Git hash to me.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 3
  • Comments: 21 (4 by maintainers)

Most upvoted comments

Thank you all for the inputs. I was able to replicate the issue now. The error occurs when semantic versioning syntax is used for the npm engine in the package.json file. Specifically, if the syntax is trying to use npm version 9.7.0.

“npm”: “9” (failed) “npm”: “>=8.0.0” (failed) “npm”: “^9.6.7” (failed) “npm”: “~9.6.7” (successful) “npm”: “9.6.7” (successful)

The npm version 9.7.0 was released last 5/31/2023, but got deprecated. So the latest and active npm version is 9.6.7.

As for the workaround, remove npm under engines in package.json file or use semantic versioning syntax that will not use npm version 9.7.0.

Removing the npm version from the engines in package.json seems to fix the problem 🤷

We can use semver’s combining range to force the correct version until there’s a new release This worked for us

  "engines": {
    "node": "18",
    "npm": ">=9.5 <9.7"
  },

Upstream bug: https://github.com/GoogleCloudPlatform/cloud-builders/issues/922

The workaround is to update your package.json engine configuration to use a previous npm version:

"engines": {
  "npm": ">=9 <9.7"
}

same problem here

We’re also seeing the same error, and are seeing it together with an error on too many concurrent builds:

Build failed: parsing npm version: Invalid Semantic Version; Error ID: f113d9b7
Build failed: Too many concurrent builds, please stagger your deployments.

same here

functions: updating Node.js 18 (1st Gen) function *****(us-central1)...
Build failed: parsing npm version: Invalid Semantic Version; Error ID: f113d9b7

Functions deploy had errors with the following functions:
        *****(us-central1)