firebase-functions: FirebaseError object endpoints[testme].availableMemoryMb failed validation

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

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 18
  • Comments: 45 (2 by maintainers)

Most upvoted comments

I fixed this by updating firebase tools

npm install -g firebase-tools

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!

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

Switch to functions folder and update firebase tools with

npm install -g firebase-tools

this worked for me 👍

Any news here? This is rather odd… Still failing builds…

For all lost souls out there who don’t deserve an answer… Here is my fix at the dependency moshpit and it works!

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

Idk support, idk…

What is going on here. I just reopen the code editor try to deploy 2 days later same code…

Error: Failed to fetch Run service undefined

What is going on here?

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

I was running into the functions: Failed to load function definition from source: FirebaseError: Failed to parse build specification error after updating to firebase-functions v4 as well. After making sure I had the latest Node version for the release I was using (eg. 16.19.1 at this point) and making sure I had the latest firebase-tools version installed, I tracked this down to an empty string being passed to the vpcConnector parameter for multiple functions’ runWith configuration blocks:

runWith({
    timeoutSeconds: 30
    memory: '256MB',
    vpcConnector: config.vpc.name,
    vpcConnectorEgressSettings: 'ALL_TRAFFIC'
})

We were using an empty string for a local function emulator level config since it isn’t used for local development, but that appears to have broken with firebase-functions@4.x.x. Changing the value to any non-empty string here resolved the issue we were running into.

Not sure if anyone else that’s running into this is doing something similar, but maybe there are other values which are also causing issues for other parameters?

"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

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

Thanks @mrodrig - I changed the value from an empty string to null and that fixed it.

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

Just check the node version - using 16.x worked for me.

Any news here? This is rather odd…

Still failing builds…

For all lost souls out there who don’t deserve an answer… Here is my fix at the dependency moshpit and it works!

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

Idk support, idk…

For me this helped:

  1. cd functions
  2. npm install
  3. npm start
  4. source ~/.zshrc
  5. npm i -g firebase-tools
  6. firebase deploy --only functions

Any news here? This is rather odd…

Still failing builds…

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.

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 👍🏻

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.