firebase-functions icon indicating copy to clipboard operation
firebase-functions copied to clipboard

FirebaseError object endpoints[testme].availableMemoryMb failed validation

Open maoo opened this issue 2 years ago • 45 comments

[REQUIRED] Version info

node: v16.13.1

firebase-functions: 4.0.0-rc.0 (also reproduced with 3.24.1)

firebase-tools: N/A (in yarn.lock)

firebase-admin: 11.1.0

[REQUIRED] Test case

const admin = require('firebase-admin');
const functions = require("firebase-functions");

admin.initializeApp();

exports.testme = functions.firestore.document('/users/{ts}')
    .onUpdate((snap, context) => {
        functions.logger.debug("This is a test");
});

[REQUIRED] Steps to reproduce

firebase deploy --only functions:testme

[REQUIRED] Expected behavior

The deployment completes successfully, as it always happened on this codebase for the last 6 months (and as far as I can recall, while working with Firebase Functions)

[REQUIRED] Actual behavior

=== Deploying to 'fenix-app-39599'...

i  deploying functions
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
i  artifactregistry: ensuring required API artifactregistry.googleapis.com is enabled...
✔  artifactregistry: required API artifactregistry.googleapis.com is enabled
✔  functions: required API cloudbuild.googleapis.com is enabled
✔  functions: required API cloudfunctions.googleapis.com is enabled
i  functions: preparing codebase default for deployment
Error: Failed to parse build specification:
- FirebaseError object endpoints[testme].availableMemoryMb failed validation

Having trouble? Try firebase [command] --help

Were you able to successfully deploy your functions?

See above.

maoo avatar Oct 15 '22 12:10 maoo

Yes, this same error has cropped up today for me as well. Please look into it urgently @firebase-ops because it's impacting our software release.

image

DhruvRaiPuri avatar Oct 15 '22 15:10 DhruvRaiPuri

Tagging @firebase-ops

DhruvRaiPuri avatar Oct 15 '22 15:10 DhruvRaiPuri

Taking a look @DhruvRaiPuri @maoo

In the meantime, can you share information about the version of firebase tools used to deploy the function?

I've tried the follow, and things are unexpectedly working for me:

$ cat index.js
const functions = require("firebase-functions");
const { initializeApp } = require("firebase-admin/app");
const { getFirestore } = require("firebase-admin/firestore")

initializeApp()

exports.testme = functions.firestore.document('/users/{ts}')
    .onUpdate((snap, context) => {
        functions.logger.debug("This is a test");
});

$ npm ls firebase-functions
functions@ /Users/...
└── [email protected]

$ firebase --version
11.14.4

$ firebase deploy --only functions:testme
... works as before

taeold avatar Oct 16 '22 18:10 taeold

@taeold It was happening in CI environment for me. I checked and firebase version was 11.1.0. Updated it to latest 11.14.4 and the GitHub Action worked. Firebase Functions version was already 4(release candidate).

Thanks for providing version details. From my end this issue is resolved.

DhruvRaiPuri avatar Oct 17 '22 06:10 DhruvRaiPuri

Thank you @DhruvRaiPuri and @taeold .

I'm using firebase-tools version 11.14.0 and it's still failing for me. I'm trying to update to 11.14.4 but for some reason the command npm install -g firebase-tools completes successfully but firebase --version is still returning 11.14.0, which is odd.

I'll keep on investigating.

maoo avatar Oct 17 '22 08:10 maoo

I got it working again. These are my steps:

  1. rm -rf functions/node_modules
  2. Update package.json to rollback versions:

From

    "firebase-admin": "^11.1.0",
    "firebase-functions": "^4.0.0-rc.0"

To

    "firebase-admin": "^10.0.2",
    "firebase-functions": "^3.23.0"

firebase --version is 11.14.0 ; node --version is 16.14.2.

I'm not sure what that issue really is, or where it's coming from, so I'll let you folks decide whether to close this issue or not.

Thanks for the support!

maoo avatar Oct 17 '22 10:10 maoo

version 4.0.0 (not release candidate, but the final version) fixed this error for me.

pjarnfelt avatar Oct 18 '22 08:10 pjarnfelt

Updating version 3.23.0 to 4.0.2 also seems to cause this issue.

mcanyucel avatar Oct 18 '22 14:10 mcanyucel

Rolled back as @maoo suggests also worked for me.

JeffThurston avatar Oct 19 '22 17:10 JeffThurston

I fixed this by updating firebase tools

npm install -g firebase-tools

Psycarlo avatar Oct 20 '22 18:10 Psycarlo

I second this. Additional note using yarn to install didn't make the cut. I still have to use npm i - g!

I fixed this by updating firebase tools

npm install -g firebase-tools

0xTogepi avatar Oct 21 '22 17:10 0xTogepi

Solucioné esto actualizando las herramientas de Firebase

npm install -g firebase-tools

Solucioné esto actualizando las herramientas de Firebase

npm install -g firebase-tools

Funciono para mi 👍🏻

israel-lpz avatar Oct 25 '22 04:10 israel-lpz

Had a similar issue. Mine was due to the fact that i've just updated my Node versions to 18.x using NVM and on top of that I primarily use PNPM. my guess is that the dependencies clashed. deleting both and then installing them again starting with npm i -g firebase-tools@latest fixed my error

kolchurinvv avatar Oct 26 '22 13:10 kolchurinvv

I'm having the same issue when on the latest version of everything.

"firebase-admin": "^11.2.0", "firebase-functions": "^4.0.1", And Firebase CLI version 11.15.0.

I'm receiving - FirebaseError object endpoints[myhook].availableMemoryMb failed validation

Joebayld avatar Oct 27 '22 04:10 Joebayld

My 2 cents: I had the same availableMemoryMb failed validation error, also running from CI, and fixed it by upgrading firebase-tools:

Had errors with: [email protected] Fixed it with: [email protected]

All while being on:

"firebase-admin": "^11.2.0",
"firebase-functions": "^4.0.1",

conceptualben avatar Oct 28 '22 23:10 conceptualben

I fixed this by updating firebase tools

npm install -g firebase-tools

@Psycarlo https://github.com/firebase/firebase-functions/issues/1263#issuecomment-1285982331 This works. Thanks!

alex-drocks avatar Nov 01 '22 03:11 alex-drocks

I fixed this by updating firebase tools

npm install -g firebase-tools

Worked for me.

DavidWeiss2 avatar Nov 12 '22 21:11 DavidWeiss2

Updating version 3.23.0 to 4.0.2 also seems to cause this issue.

I am experiencing the same. Did you manage to solve this? npm install -g firebase-tools won't do the trick for me.

agonzalezpuerta avatar Nov 15 '22 06:11 agonzalezpuerta

Updating version 3.23.0 to 4.0.2 also seems to cause this issue.

I am experiencing the same. Did you manage to solve this? npm install -g firebase-tools won't do the trick for me.

No, I just downgraded to 3.23.0 for now.

mcanyucel avatar Nov 15 '22 13:11 mcanyucel

I have the same issue. Only downgrading to 3.23.0 makes everything to work again

Zombobot1 avatar Nov 16 '22 13:11 Zombobot1

I fixed this by updating firebase tools

npm install -g firebase-tools

This worked for me as well. Be sure to switch to the functions folder.

cd functions

and then

npm install -g firebase-tools

radykal avatar Nov 21 '22 09:11 radykal

@radykal No need to switch to the functions folder since you are installing it globally with the flag -g

Psycarlo avatar Nov 21 '22 12:11 Psycarlo

I have had my firebase tools updated, I removed and reinstalled node modules(which usually works), uninstalled java and reinstalled Java 17.... and still on my Widnows PC I get the error: Error: Failed to parse build specification: FirebaseError object endpoints[sendInvitation].availableMemoryMb failed validation

My coworker has a mac and is set up the same exact way, and his works. availableMemoryMb is the issue. How do I fix this?

anthonydzign avatar Nov 23 '22 22:11 anthonydzign

We are still having some trouble reproducing the issue consistently - it looks like error may be environment dependent.

We are going to start by adding more messages around the problematic code, but if someone can help us pin down the issue to particular code/environment, it would be much appreciated.

taeold avatar Nov 23 '22 22:11 taeold

We are still having some trouble reproducing the issue consistently - it looks like error may be environment dependent.

We are going to start by adding more messages around the problematic code, but if someone can help us pin down the issue to particular code/environment, it would be much appreciated.

I would love to help. The problem is, my environment was working fine last week and today I can't even start the emulators.

anthonydzign avatar Nov 23 '22 22:11 anthonydzign

I wanted to post an update: This issue was with my environment variables. I went back to notes I took when I first set up my windows environment. I had to unistall Java and reinstall, change environment variables etc. Everything works now. JAVA_HOME should be %JAVA_HOME% (at least in my case). But there were extra characters after the 2nd %...(no idea how that got changed) that might have been the issue.

anthonydzign avatar Nov 24 '22 02:11 anthonydzign

We are still having some trouble reproducing the issue consistently - it looks like error may be environment dependent.

We are going to start by adding more messages around the problematic code, but if someone can help us pin down the issue to particular code/environment, it would be much appreciated.

My issues have been on a M2 Mac running macOS Ventura. I installed the latest version of firebase-tools and firebase-functions and this is still an issue.

UPDATE:

I seem to have fixed. For some reason, npm i -g firebase-tools was not changing the installed firebase version. I tried npm un -g firebase-tools and firebase was still there. Something seems to have broke on NPM when using NVM. I went ahead and removed node entirely from my mac and reinstalled nvm, then reinstalled firebase tools and now it's working. What a pain!

Joebayld avatar Nov 25 '22 09:11 Joebayld

If you installed firebase-tools globally, make sure to update it to the latest version with npm update -g firebase-tools.

This fixed the validation issues for me.

bartolomej avatar Dec 07 '22 12:12 bartolomej

"firebase-admin": "^11.2.1",
"firebase-functions": "^4.1.0",
"firebase-tools": "^11.18.0",

doesnt work, with all provided "solutions".. Where is the problem.. All i get is:

  • FirebaseError object endpoints[functionXYZ].availableMemoryMb failed validation

Hiti3 avatar Dec 15 '22 01:12 Hiti3

?

Hiti3 avatar Dec 15 '22 01:12 Hiti3