You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 20, 2025. It is now read-only.
This has only recently started happening for me. Some cloud functions which are using the Cloud Vision API have started failing due to an Auth error. The failures seem random, with requests working sometimes and other times not. As there is no explicit Auth happening (it's the Node JS GCF runtime for an existing project, it's not clear what could be the issue).
Errors look like this:
A 2019-10-01T03:17:00.907Z PROD-PDF-XXXX 718747420330136
Unhandled rejection PROD-PDF-XXXX 718747420330136
E 2019-10-01T03:17:00.910Z PROD-PDF-XXXX 718747420330136
Error: Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.
at GoogleAuth.getApplicationDefaultAsync (/srv/functions/node_modules/google-auth-library/build/src/auth/googleauth.js:161:19)
at process._tickCallback (internal/process/next_tick.js:68:7) PROD-PDF-XXXX 718747420330136
Triggering code is:
if(statusUpdateResult.affectedRows < 1){
// to avoid race conditions from concurrent competing threads, lets make sure this thread
// was the one that updated the status first
let concurrentThreadError = Error('Not the first to update status to processing so exiting');
console.error(concurrentThreadError);
return concurrentThreadError;
} else {
// status updated and ready for processing
console.log(`Updated pdf id ${pdfRecord.pdf_id} to queuing_vision.`);
}
// queue the file for processing by vision API
const gcsSourceUri = `gs://${bucketName}/${fileName}`;
const gcsDestinationUri = `gs://${ocrJSONBucket}/${fileName}.json`;
const inputConfig = {
// Supported mime_types are: 'application/pdf' and 'image/tiff'
mimeType: 'application/pdf',
gcsSource: {
uri: gcsSourceUri,
},
};
const outputConfig = {
gcsDestination: {
uri: gcsDestinationUri,
},
};
const features = [{type: 'DOCUMENT_TEXT_DETECTION'}];
const request = {
requests: [
{
inputConfig: inputConfig,
features: features,
outputConfig: outputConfig,
},
],
};
console.log(processingOperation);
var processingOperation;
try {
processingOperation = visionClient.asyncBatchAnnotateFiles(request);
} catch(processingError) {
console.error(processingError);
return processingError;
}
console.log(processingOperation);
The unhandled rejection is happening inside the Vision request try/catch block so there's nowhere further to debug for me, hope someone can help or is getting the same issue. This used to work without issue.
Environment details
Google Cloud Functions, Node JS 10 (Beta) Platform
NPM is building with "@google-cloud/vision" : ">=1.2.0" so likely latest version
Steps to reproduce
Using a GCF function on the Node JS 10 runtime, in a project with all api/auth enabled.
Make a request to visionClient.asyncBatchAnnotateFiles.
This has only recently started happening for me. Some cloud functions which are using the Cloud Vision API have started failing due to an Auth error. The failures seem random, with requests working sometimes and other times not. As there is no explicit Auth happening (it's the Node JS GCF runtime for an existing project, it's not clear what could be the issue).
Errors look like this:
Triggering code is:
The unhandled rejection is happening inside the Vision request try/catch block so there's nowhere further to debug for me, hope someone can help or is getting the same issue. This used to work without issue.
Environment details
Steps to reproduce