Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failed: parsing npm version: Invalid Semantic Version; Error ID: f113d9b7 when trying to deploy functions #5922

Closed
sceee opened this issue Jun 1, 2023 · 21 comments

Comments

@sceee
Copy link
Contributor

sceee commented Jun 1, 2023

[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.

@looptheloop88
Copy link

Hi @sceee, thanks for the report. I wasn't able to replicate the issue even though I've already used the same version of firebase-tools, npm and node.

I wrote and deployed a simple 1st Gen function, updated it then redeployed again. I didn’t encounter any issues or errors while deploying the function.

Are you seeing this error consistently? Would you mind sharing a sample code snippet of the 1st Gen function and the dependencies listed in your package.json file? Also, could you add --debug parameter in the deployment command you’re using and share the logs with us?

@looptheloop88 looptheloop88 added the Needs: Author Feedback Issues awaiting author feedback label Jun 1, 2023
@richtu4n
Copy link

richtu4n commented Jun 1, 2023

We also have this issue, nothing has changed in our code, everything worked before and as of today we're getting this same error.

Build failed: parsing npm version: Invalid Semantic Version; Error ID: f113d9b7

@looptheloop88
Copy link

Just to confirm, are you trying to deploy the same function without any code changes? If so, did you see any message from the deployment logs indicating that that deployment of unchanged functions will be skipped?

@sceee
Copy link
Contributor Author

sceee commented Jun 1, 2023

@looptheloop88 it happened for both, functions with code change and functions without code changes (but dependency updates).

@google-oss-bot google-oss-bot added Needs: Attention and removed Needs: Author Feedback Issues awaiting author feedback labels Jun 1, 2023
@looptheloop88
Copy link

@sceee thanks for the quick response. We need additional information from you to help us with the investigation. Please share the firebase-functions version that you're using or better if you could share the dependencies in the package.json file. Also, please try to get some logs by adding --debug parameter in the command you're using for deployment.

@looptheloop88 looptheloop88 added Needs: Author Feedback Issues awaiting author feedback and removed Needs: Attention labels Jun 1, 2023
@inlined
Copy link
Member

inlined commented Jun 1, 2023

This error doesn't appear in the Firebase codebase, so it seems like there might be a tool that we depend on (e.g. npm) that is misconfigured. Can you provide your package.json? Feel free to redact anything sensitive such as dependencies or name.

@sceee
Copy link
Contributor Author

sceee commented Jun 1, 2023

Here are some parts of the package.json (name stripped, scripts stripped, some dependencies stripped):

{
  "name": "..........",
  "scripts": {
........
  },
  "engines": {
    "node": "18",
    "npm": "9"
  },
  "main": "lib/src/index.js",
  "dependencies": {
.......
    "firebase-admin": "^11.9.0",
    "firebase-functions": "^4.4.0",
.......
  },
  "devDependencies": {
    "@firebase/rules-unit-testing": "^2.0.7",
......
    "firebase": "^9.22.1",
    "firebase-functions-test": "^3.1.0",
.......
  },
  "private": true
}

@looptheloop88 firebase-functions is v4.4.0 (lockfile).

@google-oss-bot google-oss-bot added Needs: Attention and removed Needs: Author Feedback Issues awaiting author feedback labels Jun 1, 2023
@richtu4n
Copy link

richtu4n commented Jun 1, 2023

Not sure if this provides any more information, but this error detail comes before the error discussed above.
Screenshot 2023-06-01 at 21 48 02

Here's our package.json

{
  "name": "firebase-functions",
  "version": "0.0.0",
  "main": "index.js",
  "private": true,
  "dependencies": {
    ...
    "firebase-admin": "^11.5.0",
    ...
    "firebase-functions": "^4.2.1",
    ...
  },
  "engines": {
    "node": "18",
    "npm": ">=8.0.0"
  }
}

firebase-functions: v4.4.0 (lockfile)
firebase-tools: v11.20.0 (locally)

@damorkas
Copy link

damorkas commented Jun 2, 2023

Started getting exact same error about ~20 hours ago.

Tried to update firebase-tools to the latest cause I see v12.3.0 showed up 5 hours ago but still same error.

@chrisfougner
Copy link

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.

@hendrik244
Copy link

same problem here

@richtu4n
Copy link

richtu4n commented Jun 2, 2023

Has anyone figured out a work around? We've completely lost our ability to deploy and rollback due to this issue 😵‍💫

@rvmoldova
Copy link

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)

@MehdiSaffar-Batelle
Copy link

I thought I was the only one with this error

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

Is there a workaround? Using Node.js 18 with v1 functions

@albertjan
Copy link

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

@gboston
Copy link

gboston commented Jun 2, 2023

Also seeing failing builds with cloud build. I've fixed it by pinning npm in the engines to 9.6.7. This prevents the new 9.7.0 to be used and apparently fixes the issue.

@mpsq
Copy link

mpsq commented Jun 2, 2023

Upstream bug: GoogleCloudPlatform/cloud-builders#922

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

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

@looptheloop88
Copy link

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.

@andredifs
Copy link

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.

It works for me:

"engines": {
    "node": "16",
    "npm": "~8.5.5", // before:  "npm": ">= 6.13.4",
    "yarn": ">= 1.21.1"
}

@AlexBeauchemin
Copy link

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"
  },

@aalej
Copy link
Contributor

aalej commented Jun 15, 2023

Hey everyone! Per checking, it looks like a new version of npm was released, v9.7.1. I’ve tried out the following configurations and all seems to work properly:

"npm": ">=9"
"npm": "9"
"npm": "^9.6.7"

With that being said, I’m going to close this issue. If anyone thinks this may be a mistake, feel free to ask this issue to be reopened. Thanks!

@aalej aalej closed this as completed Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests