@@ -18,7 +18,7 @@ import {FirebaseApp} from '../firebase-app';
1818import { FirebaseError } from '../utils/error' ;
1919import { FirebaseServiceInterface , FirebaseServiceInternalsInterface } from '../firebase-service' ;
2020import { ApplicationDefaultCredential , Certificate } from '../auth/credential' ;
21- import { Bucket } from '@google-cloud/storage' ;
21+ import * as gcs from '@google-cloud/storage' ;
2222
2323import * as validator from '../utils/validator' ;
2424
@@ -58,7 +58,7 @@ export class Storage implements FirebaseServiceInterface {
5858 } ) ;
5959 }
6060
61- let storage ;
61+ let storage : typeof gcs ;
6262 try {
6363 /* tslint:disable-next-line:no-var-requires */
6464 storage = require ( '@google-cloud/storage' ) ;
@@ -75,6 +75,7 @@ export class Storage implements FirebaseServiceInterface {
7575 // cert is available when the SDK has been initialized with a service account JSON file,
7676 // or by setting the GOOGLE_APPLICATION_CREDENTIALS envrionment variable.
7777 this . storageClient = storage ( {
78+ projectId : cert . projectId ,
7879 credentials : {
7980 private_key : cert . privateKey ,
8081 client_email : cert . clientEmail ,
@@ -102,7 +103,7 @@ export class Storage implements FirebaseServiceInterface {
102103 * retrieves a reference to the default bucket.
103104 * @return {Bucket } A Bucket object from the @google-cloud/storage library.
104105 */
105- public bucket ( name ?: string ) : Bucket {
106+ public bucket ( name ?: string ) : gcs . Bucket {
106107 const bucketName = ( typeof name !== 'undefined' )
107108 ? name : this . appInternal . options . storageBucket ;
108109 if ( validator . isNonEmptyString ( bucketName ) ) {
0 commit comments