@@ -58,7 +58,10 @@ function assertRuntimeOptionsValid(runtimeOptions: RuntimeOptions): boolean {
58
58
`The only valid memory allocation values are: ${ VALID_MEMORY_OPTIONS . join ( ", " ) } `
59
59
) ;
60
60
}
61
- if ( runtimeOptions . timeoutSeconds > MAX_TIMEOUT_SECONDS || runtimeOptions . timeoutSeconds < 0 ) {
61
+ if (
62
+ typeof runtimeOptions . timeoutSeconds === "number" &&
63
+ ( runtimeOptions . timeoutSeconds > MAX_TIMEOUT_SECONDS || runtimeOptions . timeoutSeconds < 0 )
64
+ ) {
62
65
throw new Error ( `TimeoutSeconds must be between 0 and ${ MAX_TIMEOUT_SECONDS } ` ) ;
63
66
}
64
67
@@ -236,7 +239,7 @@ function validateFailurePolicy(policy: any) {
236
239
* @param regions list of regions.
237
240
* @throws { Error } Regions must be in list of supported regions.
238
241
*/
239
- function assertRegionsAreValid ( regions : string [ ] ) : boolean {
242
+ function assertRegionsAreValid ( regions : ( string | Expression < string > | ResetValue ) [ ] ) : boolean {
240
243
if ( ! regions . length ) {
241
244
throw new Error ( "You must specify at least one region" ) ;
242
245
}
@@ -252,7 +255,7 @@ function assertRegionsAreValid(regions: string[]): boolean {
252
255
* functions.region('us-east1', 'us-central1')
253
256
*/
254
257
export function region (
255
- ...regions : Array < ( typeof SUPPORTED_REGIONS ) [ number ] | string >
258
+ ...regions : Array < ( typeof SUPPORTED_REGIONS ) [ number ] | string | Expression < string > | ResetValue >
256
259
) : FunctionBuilder {
257
260
if ( assertRegionsAreValid ( regions ) ) {
258
261
return new FunctionBuilder ( { regions } ) ;
@@ -294,7 +297,9 @@ export class FunctionBuilder {
294
297
* @example
295
298
* functions.region('us-east1', 'us-central1')
296
299
*/
297
- region ( ...regions : Array < ( typeof SUPPORTED_REGIONS ) [ number ] | string > ) : FunctionBuilder {
300
+ region (
301
+ ...regions : Array < ( typeof SUPPORTED_REGIONS ) [ number ] | string | Expression < string > | ResetValue >
302
+ ) : FunctionBuilder {
298
303
if ( assertRegionsAreValid ( regions ) ) {
299
304
this . options . regions = regions ;
300
305
return this ;
0 commit comments