Repository navigation
Vision 'detect' method doesn't return values when image is remote url #2087
Description
Activity
Here is the error I get.
PartialFailureError: A failure occurred during this request. at node_modules/@google-cloud/vision/src/index.js:420:15 at node_modules/@google-cloud/vision/src/index.js:121:5 at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickCallback (internal/process/next_tick.js:98:9)FYI this is running on local machine.
The API is returning an error for that image:
{ code: 500, message: 'image-annotator::error(12): We can not access the URL currently. Please download the image and pass it in.' }
To access this error:
console.log(err.errors[0].errors)
I know that's pretty goofy, but the layering of
erris:- err: PartialFailureError - Since the API accepts multiple images and multiple annotation types, some can fail, while others can succeed. We return these in a single argument, the error to the callback
- errors - This array holds the errors
- errors[0] - This is the first error of the partial failure
- image - This lets you know what image the error is referencing
- errors - There can be multiple reasons why the error occurred (perhaps it was a straight-up 500 like in this case, or an image was unfit for the requested annotation type)
- errors[0] - The actual error from the API
- code - The HTTP response status code
- message - The HTTP response status message
- type - The detection type that was requested (e.g.
labels)
- errors[0] - The actual error from the API
- errors[0] - This is the first error of the partial failure
- errors - This array holds the errors
Sorry for the confusion.
As far as why Vision cannot access the URL, I'm not sure-- could you open the question on StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform+google-cloud-vision? Googlers from the various service APIs look through those questions and are usually pretty quick to respond.
- err: PartialFailureError - Since the API accepts multiple images and multiple annotation types, some can fail, while others can succeed. We return these in a single argument, the error to the callback
- addedapi: visionIssues related to the Cloud Vision API.Issues related to the Cloud Vision API.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.
on Mar 15, 2017 Thank you. That helps.
Is it possible to send base64 encoded image through the detect api in node instead of file name?
Yep, if provided as a buffer, either like:
var image = new Buffer('...', 'base64')
Here's an example with
request:request('image-url', { encoding: null /* returns a Buffer */ }, function(err, resp, body) { vision.detect(body, ['label','properties'], function(err, detection, apiResponse) {}) })
I was detecting remote URL images with an older version of google cloud and it worked fine. However since google cloud 0.50.0, google-cloud has been deprecated.
npm WARN deprecated [email protected]: The google-cloud meta-package is not recommended; install individual packages.I now get the same error as you with remote URL images when using the new way to access vision:
@google-cloud/visionI may be sticking with the older version until this issue is solved.
npm install google-cloud --save var gcloud = require('google-cloud'); var vision = gcloud.vision();I've been having the same issue starting yesterday (7/14), specifically with passing the URL of an image being served from AWS Cloudfront (something like:
https://screenshots.cdn.gometa.io/A5A74799-8D42-44E4-8D5D-D54BA1B92CD9.jpg). The problem is intermittent & I cannot consistently reproduce. Sometimes it works for an hour, then goes back to failing with that500error.Temporarily solved on our end by fetching the image and passing the buffer instead of the remote URL, but wanted to comment letting you folks know. It could easily be an issue with regard to the CDN, but I don't have enough exposure into the error to understand why the fetch is failing.
- added 6 commits that reference this issue
on Feb 25, 2026
When passing in local image url API works great. When passing remote image url api does not provide any results. Here is my code for reference: