@@ -76,14 +76,7 @@ export async function doSetup(
7676 webAppName : string | null ,
7777 serviceAccount : string | null ,
7878) : Promise < void > {
79- await Promise . all ( [
80- ensure ( projectId , developerConnectOrigin ( ) , "apphosting" , true ) ,
81- ensure ( projectId , cloudbuildOrigin ( ) , "apphosting" , true ) ,
82- ensure ( projectId , secretManagerOrigin ( ) , "apphosting" , true ) ,
83- ensure ( projectId , cloudRunApiOrigin ( ) , "apphosting" , true ) ,
84- ensure ( projectId , artifactRegistryDomain ( ) , "apphosting" , true ) ,
85- ensure ( projectId , iamOrigin ( ) , "apphosting" , true ) ,
86- ] ) ;
79+ await ensureRequiredApisEnabled ( projectId ) ;
8780
8881 // Hack: Because IAM can take ~45 seconds to propagate, we provision the service account as soon as
8982 // possible to reduce the likelihood that the subsequent Cloud Build fails. See b/336862200.
@@ -179,6 +172,20 @@ export async function doSetup(
179172 logSuccess ( `Your backend is now deployed at:\n\thttps://${ backend . uri } ` ) ;
180173}
181174
175+ /**
176+ * Check that all GCP APIs required for App Hosting are enabled.
177+ */
178+ export async function ensureRequiredApisEnabled ( projectId : string ) : Promise < void > {
179+ await Promise . all ( [
180+ ensure ( projectId , developerConnectOrigin ( ) , "apphosting" , true ) ,
181+ ensure ( projectId , cloudbuildOrigin ( ) , "apphosting" , true ) ,
182+ ensure ( projectId , secretManagerOrigin ( ) , "apphosting" , true ) ,
183+ ensure ( projectId , cloudRunApiOrigin ( ) , "apphosting" , true ) ,
184+ ensure ( projectId , artifactRegistryDomain ( ) , "apphosting" , true ) ,
185+ ensure ( projectId , iamOrigin ( ) , "apphosting" , true ) ,
186+ ] ) ;
187+ }
188+
182189/**
183190 * Set up a new App Hosting-type Developer Connect GitRepoLink, optionally with a specific connection ID
184191 */
0 commit comments