Skip to content

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

Closed
@BenLLong

Description

@BenLLong

Related issues

#834
#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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions