@@ -46,7 +46,7 @@ export type RetryPolicy =
4646
4747/** Settings for building a container out of the customer source. */
4848export interface BuildConfig {
49- runtime : supported . Runtime ;
49+ runtime ? : supported . Runtime ;
5050 entryPoint : string ;
5151 source : Source ;
5252 sourceToken ?: string ;
@@ -158,7 +158,7 @@ export interface EventTrigger {
158158interface CloudFunctionBase {
159159 name : string ;
160160 description ?: string ;
161- buildConfig : BuildConfig ;
161+ buildConfig ? : BuildConfig ;
162162 serviceConfig ?: ServiceConfig ;
163163 eventTrigger ?: EventTrigger ;
164164 labels ?: Record < string , string > | null ;
@@ -172,6 +172,7 @@ export type OutputCloudFunction = CloudFunctionBase & {
172172} ;
173173
174174export type InputCloudFunction = CloudFunctionBase & {
175+ buildConfig : BuildConfig ;
175176 // serviceConfig is required.
176177 serviceConfig : ServiceConfig ;
177178} ;
@@ -228,7 +229,7 @@ function functionsOpLogReject(func: InputCloudFunction, type: string, err: any):
228229 "Either reduce this function's maximum instances, or request a quota increase on the underlying Cloud Run service " +
229230 "at https://cloud.google.com/run/quotas." ,
230231 ) ;
231- const suggestedFix = func . buildConfig . runtime . startsWith ( "python" )
232+ const suggestedFix = func . buildConfig . runtime ? .startsWith ( "python" )
232233 ? "firebase_functions.options.set_global_options(max_instances=10)"
233234 : "setGlobalOptions({maxInstances: 10})" ;
234235 utils . logLabeledWarning (
@@ -436,7 +437,7 @@ export function functionFromEndpoint(endpoint: backend.Endpoint): InputCloudFunc
436437 ) ;
437438 }
438439
439- if ( ! supported . isRuntime ( endpoint . runtime ) ) {
440+ if ( endpoint . runtime && ! supported . isRuntime ( endpoint . runtime ) ) {
440441 throw new FirebaseError (
441442 "Failed internal assertion. Trying to deploy a new function with a deprecated runtime." +
442443 " This should never happen" ,
@@ -446,7 +447,7 @@ export function functionFromEndpoint(endpoint: backend.Endpoint): InputCloudFunc
446447 const gcfFunction : InputCloudFunction = {
447448 name : backend . functionName ( endpoint ) ,
448449 buildConfig : {
449- runtime : endpoint . runtime ,
450+ runtime : endpoint . runtime || undefined ,
450451 entryPoint : endpoint . entryPoint ,
451452 source : {
452453 storageSource : endpoint . source ?. storageSource ,
@@ -664,7 +665,7 @@ export function endpointFromFunction(gcfFunction: OutputCloudFunction): backend.
664665 trigger = { httpsTrigger : { } } ;
665666 }
666667
667- if ( ! supported . isRuntime ( gcfFunction . buildConfig . runtime ) ) {
668+ if ( gcfFunction . buildConfig ?. runtime && ! supported . isRuntime ( gcfFunction . buildConfig . runtime ) ) {
668669 logger . debug ( "GCFv2 function has a deprecated runtime:" , JSON . stringify ( gcfFunction , null , 2 ) ) ;
669670 }
670671
@@ -674,9 +675,9 @@ export function endpointFromFunction(gcfFunction: OutputCloudFunction): backend.
674675 project,
675676 region,
676677 ...trigger ,
677- entryPoint : gcfFunction . buildConfig . entryPoint ,
678- runtime : gcfFunction . buildConfig . runtime ,
679- source : gcfFunction . buildConfig . source ,
678+ entryPoint : gcfFunction . buildConfig ? .entryPoint || "" ,
679+ runtime : gcfFunction . buildConfig ? .runtime || undefined ,
680+ source : gcfFunction . buildConfig ? .source ,
680681 } ;
681682 if ( gcfFunction . serviceConfig ) {
682683 proto . copyIfPresent (
0 commit comments