async function getCreds()

in src/auth.js [25:44]


async function getCreds() {
  try {
    logger.log(`Retrieving application default credentials...`)
    const creds = await getApplicationDefaultCredentials();
    return creds;
  } catch (err) {
    logger.debug(`Failed to retrieve application default credentials: ${err.message}. Fall back to gcloud credentials.`);
  }
  try {
    logger.log(`Retrieving credentials from gcloud...`)
    const creds = await getGcloudCredentials();
    return creds;
  } catch (err) {
    logger.debug(`Failed to retrieve credentials from gcloud: ${err.message}.`)
  }
  throw new Error(
      'Fail to get credentials. Please run: \n' +
      '`gcloud auth application-default login`, `gcloud auth login`, or \n' +
      '`export GOOGLE_APPLICATION_CREDENTIALS=<path/to/service/account/key>`');
}