Skip to content

Setting memory to more than 1 GiB still only allow 1 GiB to be used #3716

@ibobo

Description

@ibobo

Related issues

None.

[REQUIRED] Version info

node: v12.22.1

firebase-functions: 3.15.4

firebase-tools: 9.16.5

firebase-admin: 9.11.1

[REQUIRED] Test case

export const test = functions
  .runWith({
    memory: '8GB',
  })
  .https.onRequest(async (req, res) => {
    console.log(process.env);
  });

[REQUIRED] Steps to reproduce

Just try to deploy the above mentioned function

[REQUIRED] Expected behavior

The function gets deployed with the indicated memory and it can fully use the 8 GiB memory.

[REQUIRED] Actual behavior

The function gets deployed with the indicated memory, but, it won't be able to use it all, since the runtime is configured to only use 1 or 2 GiB.

As stated in the Google Cloud documentation here, you need to specify the NODE_OPTIONS environment variable to have a max_old_space_size value (8192 for 8 GiB), but this is not possible with current firebase-functions deployment process.

I suggest that when a function is required to have more than 1 GiB memory size the given NODE_OPTIONS environment variable is set automatically. At this stage, to have it set, I need to go to Google Cloud Console, edit the function and manually add the environment variable (or at least check it was retained) after every deploy.

Were you able to successfully deploy your functions?

Yes.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions