Closer/functions/src/options.ts

20 lines
1018 B
TypeScript
Raw Normal View History

import { setGlobalOptions } from 'firebase-functions/v2'
/**
* Global 2nd-gen options for every v2 function in this codebase.
*
* region: pinned to us-central1 the Android client calls FirebaseFunctions.getInstance() with
* no region override (di/SecurityModule.kt, data/remote/FirestoreAnswerDataSource.kt), so the
* callables MUST live in us-central1 or every install breaks. Do not change without also
* pinning the client.
* maxInstances: a runaway-bill guardrail, not a throughput target (v2 serves ~80 concurrent
* requests per instance, so 20 instances is ample at current scale). Revisit at launch.
*
* This module is imported FIRST in index.ts so these options are set before any v2 function is
* defined. It has no effect on the one v1 holdout (onUserDelete), which keeps its own defaults.
*/
setGlobalOptions({ region: 'us-central1', maxInstances: 20 })
/** Region constant for any per-function override that ever needs to pin it explicitly. */
export const REGION = 'us-central1'