File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed
Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -192,10 +192,17 @@ export async function createBackend(
192192 try {
193193 return await createBackendAndPoll ( ) ;
194194 } catch ( err : any ) {
195- if ( err . status === 403 && err . message . includes ( defaultServiceAccount ) ) {
196- // Create the default service account if it doesn't exist and try again.
197- await provisionDefaultComputeServiceAccount ( projectId ) ;
198- return await createBackendAndPoll ( ) ;
195+ if ( err . status === 403 ) {
196+ if ( err . message . includes ( defaultServiceAccount ) ) {
197+ // Create the default service account if it doesn't exist and try again.
198+ await provisionDefaultComputeServiceAccount ( projectId ) ;
199+ return await createBackendAndPoll ( ) ;
200+ } else if ( serviceAccount && err . message . includes ( serviceAccount ) ) {
201+ throw new FirebaseError (
202+ `Failed to create backend due to missing delegation permissions for ${ serviceAccount } . Make sure you have the iam.serviceAccounts.actAs permission.` ,
203+ { children : [ err ] } ,
204+ ) ;
205+ }
199206 }
200207 throw err ;
201208 }
Original file line number Diff line number Diff line change @@ -138,7 +138,10 @@ describe("operationsConverter", () => {
138138 cloudBuildConnRepo ,
139139 /* serviceAccount= */ "my-service-account" ,
140140 ) ,
141- ) . to . be . rejectedWith ( FirebaseError , "missing actAs permission on my-service-account" ) ;
141+ ) . to . be . rejectedWith (
142+ FirebaseError ,
143+ "Failed to create backend due to missing delegation permissions for my-service-account. Make sure you have the iam.serviceAccounts.actAs permission." ,
144+ ) ;
142145
143146 expect ( createBackendStub ) . to . be . calledOnce ;
144147 expect ( createServiceAccountStub ) . to . not . have . been . called ;
You can’t perform that action at this time.
0 commit comments