I am using the @google-cloud/logging-bunyan to log my GKE backend to Stackdriver. Everything works normal when i test it locally by addind the google credential as follow :
projectId: 'yassir-log-collection-prj',
keyFilename: __dirname+'/yassir-log-collection-prj.json',
Then i removed these two lines to push to code to the staging envirenment on GKE and it worked. Then i pushed it to the production and it worked fine as well. But yesterday after a redeployment of an unrelated part of the backend, it started throwing the following errors in my logs :
Error: Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.
at GoogleAuth.getApplicationDefaultAsync (/usr/src/app/node_modules/google-auth-library/build/src/auth/googleauth.js:161)
at process._tickCallback (next_tick.js:68)
But only like 0.2% of the time. most logs did passed but still i cannot afford to let happen. is there a solution ?