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

functions.runWith 'memory' option onFinalize storage trigger deploys with default 256MB

Open BenLLong opened this issue 3 years ago • 5 comments

Related issues

https://github.com/firebase/firebase-functions/issues/834 https://github.com/firebase/firebase-functions/pull/842

[REQUIRED] Version info

node: v14.18.1

firebase-functions: 3.18.0

firebase-tools: 10.1.5

firebase-admin: 10.0.2

[REQUIRED] Test case

import v8 = require('v8')
const appBucket = 'not-a-default-bucket'
export const storageTrigger = functions.runWith({
  timeoutSeconds: 300,
  memory: '4GB',
}).storage
  .bucket(appBucket)
  .object().onFinalize( (object) => {
    functions.logger.log('memory allocation:', v8.getHeapStatistics())
})

[REQUIRED] Steps to reproduce

firebase deploy --only functions:storageTrigger

[REQUIRED] Expected behavior

Deploy function with 4GB of memory available. Function to run with 4GB allocated memory.

[REQUIRED] Actual behavior

Function runs with 256MB of allocated memory.

Were you able to successfully deploy your functions?

Yes, but it deployed with the incorrect memory allocation for running the function. No error or warning messages when deploying.

I've been using a workaround to manually set the runtime settings via the Google Cloud console. While the console will reflect the deployed runtime settings (4GB) following deployment, when the function is executed, it will only run with 256MB. To remedy, I manually edit (using the 4GB allocation setting already selected), save, and deploy the function from the console. The function will then run with the expected 4GB memory allocation.

BenLLong avatar Feb 17 '22 00:02 BenLLong

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

google-oss-bot avatar Feb 17 '22 00:02 google-oss-bot

I'm seeing a similar issue with timeoutSeconds. This is not a problem in firebase-functions v3.14.1, but is for v3.18.0

opdich avatar Feb 17 '22 23:02 opdich

I am also having same problem.

joelstevick avatar Mar 13 '22 23:03 joelstevick

Is this still happening in v11?

MauriceArikoglu avatar Jul 03 '22 09:07 MauriceArikoglu

@MauriceArikoglu , not sure, I am at 10.x. But, that is a good suggestion -- upgrade and see if that fixes it

joelstevick avatar Jul 03 '22 17:07 joelstevick

This was fixed and released in 10.3.0:

https://github.com/firebase/firebase-tools/commit/94b3156f033c7cab75001409b305edb29a26d688

Please feel free to re-open or create a new ticket if the problem persists.

taeold avatar Dec 13 '22 20:12 taeold