Clara
Clara

Reputation: 65

Memory allocation of 4GB ignored in Firebase Cloud Function

I would like to update the memory allocation limit of a Firebase Cloud Function to 4GB. I updated the memory value with the runWith parameter:

functions.runWith({memory: "4GB"})

This, however, is being ignored and the deployed function does not have 4 GB of memory allocated.

If I try with 3GB, i get this error:

Error: The only valid memory allocation values are: 128MB, 256MB, 512MB, 1GB, 2GB, 4GB

So it seems 4 GB is a valid value.

What am I doing wrong? Am I missing something?

It seems to work just fine if I use 2GB, 1GB... It only ignores the 4 GB value.

Upvotes: 3

Views: 1631

Answers (2)

griffins
griffins

Reputation: 8246

As of 2022 July

memory: amount of memory to allocate to the function, possible values are: '128MB', '256MB', '512MB', '1GB', '2GB', '4GB', and '8GB'.

functions.runWith({
    memory: '4GB',

}).firestore

Upvotes: 0

Nader Hanna
Nader Hanna

Reputation: 46

I had the exact same issue and reached out to Firebase Support to report the bug. According to Firebase Support, they acknowledge it's a bug and will release a fix in their next release.

In the time of reading, if the issue is not fixed this is the workaround:

  1. Go the GCP console and select your project
  2. select Cloud Functions from the menu on the left
  3. Click "edit"
  4. Expand the section "VARIABLES, NETWORKING AND ADVANCED SETTINGS"
  5. Change the "memory allocated" field.
  6. Click "Next" and then click on "Deploy"

EDIT: The fix has been released in [email protected]

Upvotes: 3

Related Questions