Skip to content

Crash when deploying change to minInstances on v1 function in us-west1 due to undefined tier #6980

@dominics

Description

@dominics

[REQUIRED] Environment info

firebase-tools: 13.7.1
Platform: macOS / Linux

[REQUIRED] Test case

firebase deploy --only functions --project my-project --debug

However, you must also have a function with endpoint=gcfv1, region=us-west1

[REQUIRED] Steps to reproduce

Try to change reduce to zero the minInstances of the gcfv1 function in us-west1 and deploy

[REQUIRED] Expected behavior

The CLI shows a pricing warning about the minimum instances

[REQUIRED] Actual behavior

Crash with:

[2024-04-10T10:47:37.720Z] TypeError: Cannot read properties of undefined (reading 'ram')
at Object.monthlyMinInstanceCost (/proj/node_modules/firebase-tools/lib/deploy/functions/pricing.js:147:38)
at /proj/node_modules/firebase-tools/lib/deploy/functions/prompts.js:139:32
at Array.some (<anonymous>)
at Object.someEndpoint (/proj/node_modules/firebase-tools/lib/deploy/functions/backend.js:263:38)
at promptForMinInstances (/proj/node_modules/firebase-tools/lib/deploy/functions/prompts.js:124:35)
at prepare (/proj/node_modules/firebase-tools/lib/deploy/functions/prepare.js:177:47)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async chain (/proj/node_modules/firebase-tools/lib/deploy/index.js:38:9)
at async deploy (/proj/node_modules/firebase-tools/lib/deploy/index.js:95:5)

Error: An unexpected error has occurred.
  • This is because at line 146 of pricing.js, tier is undefined (because at line 142, the V1_REGION_TO_TIER[endpoint.region] index fails)
  • This is in turn because V1_REGION_TO_TIER earlier in the file does not contain an entry for us-west1 (only us-west2 through us-west4, and despite V2_REGION_TO_TIER containing it)

Notes

Is this (v1 function in us-west1) an unsupported configuration?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions