@@ -82,46 +82,37 @@ export default async function (context: Context, options: Options): Promise<void
8282 }
8383 }
8484
85- let zippedSource : { file : string ; removeCallback : ( ) => void } | undefined ;
86- try {
87- zippedSource = isLocalBuild
88- ? await util . createLocalBuildTarArchive ( cfg , rootDir , builtAppDir )
89- : await util . createSourceDeployArchive ( cfg , rootDir ) ;
85+ const zippedSourcePath = isLocalBuild
86+ ? await util . createLocalBuildTarArchive ( cfg , rootDir , builtAppDir )
87+ : await util . createSourceDeployArchive ( cfg , rootDir ) ;
9088
91- const zippedSourcePath = zippedSource . file ;
89+ logLabeledBullet (
90+ "apphosting" ,
91+ `Zipped ${ isLocalBuild ? "built app" : "source" } for backend ${ cfg . backendId } ` ,
92+ ) ;
9293
93- logLabeledBullet (
94- "apphosting" ,
95- `Zipped ${ isLocalBuild ? "built app" : "source" } for backend ${ cfg . backendId } ` ,
96- ) ;
97-
98- const backendLocation = context . backendLocations [ cfg . backendId ] ;
99- if ( ! backendLocation ) {
100- throw new FirebaseError (
101- `Failed to find location for backend ${ cfg . backendId } . Please contact support with the contents of your firebase-debug.log to report your issue.` ,
102- ) ;
103- }
104- logLabeledBullet (
105- "apphosting" ,
106- `Uploading ${ isLocalBuild ? "built app" : "source" } for backend ${ cfg . backendId } ...` ,
107- ) ;
108- const bucketName = bucketsPerLocation [ backendLocation ] ! ;
109- const { bucket, object } = await gcs . uploadObject (
110- {
111- file : zippedSourcePath ,
112- stream : fs . createReadStream ( zippedSourcePath ) ,
113- } ,
114- bucketName ,
115- isLocalBuild ? gcs . ContentType . TAR : gcs . ContentType . ZIP ,
94+ const backendLocation = context . backendLocations [ cfg . backendId ] ;
95+ if ( ! backendLocation ) {
96+ throw new FirebaseError (
97+ `Failed to find location for backend ${ cfg . backendId } . Please contact support with the contents of your firebase-debug.log to report your issue.` ,
11698 ) ;
117- logLabeledBullet ( "apphosting" , `Uploaded at gs://${ bucket } /${ object } ` ) ;
118- context . backendStorageUris [ cfg . backendId ] =
119- `gs://${ bucketName } /${ path . basename ( zippedSourcePath ) } ` ;
120- } finally {
121- if ( zippedSource ) {
122- zippedSource . removeCallback ( ) ;
123- }
12499 }
100+ logLabeledBullet (
101+ "apphosting" ,
102+ `Uploading ${ isLocalBuild ? "built app" : "source" } for backend ${ cfg . backendId } ...` ,
103+ ) ;
104+ const bucketName = bucketsPerLocation [ backendLocation ] ! ;
105+ const { bucket, object } = await gcs . uploadObject (
106+ {
107+ file : zippedSourcePath ,
108+ stream : fs . createReadStream ( zippedSourcePath ) ,
109+ } ,
110+ bucketName ,
111+ isLocalBuild ? gcs . ContentType . TAR : gcs . ContentType . ZIP ,
112+ ) ;
113+ logLabeledBullet ( "apphosting" , `Uploaded at gs://${ bucket } /${ object } ` ) ;
114+ context . backendStorageUris [ cfg . backendId ] =
115+ `gs://${ bucketName } /${ path . basename ( zippedSourcePath ) } ` ;
125116 } ) ,
126117 ) ;
127118}
0 commit comments