As I am running my unit test through bitbucket pipelines, the below error occurs in some of the tests
Uncaught Error: Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.
at GoogleAuth.getApplicationDefaultAsync (node_modules/google-auth-library/build/src/auth/googleauth.js:183:19)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at GoogleAuth.getClient (node_modules/google-auth-library/build/src/auth/googleauth.js:565:17)
at GrpcClient._getCredentials (node_modules/google-gax/src/grpc.ts:202:20)
at GrpcClient.createStub (node_modules/google-gax/src/grpc.ts:404:19)
This error occurs only for the test cases that are testing Cloud functions that use the Logging service which is imported from @google-cloud/logging
Please note that my project is initialized with a service key
const serviceAccount = environment.FirebaseCredentials as admin.ServiceAccount;
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: `https://${projectId}.firebaseio.com`,
storageBucket: `${projectId}.appspot.com`,
});
When running the unit tests locally they usually work as well, however, they return an error when running through bitbucket pipelines
What should I do to solve this problem?