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 }}
Repository navigation
Vision 'detect' method doesn't return values when image is remote url #2087
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:
'use strict'// Imports the Google Cloud client libraryconstVision=require('@google-cloud/vision');// Your Google Cloud Platform project IDconstprojectId='my-id-is-here';// Instantiates a clientconstvisionClient=Vision({projectId: projectId,keyFilename: 'service.json'});varimg='https://d13yacurqjgara.cloudfront.net/users/995236/screenshots/3024565/day-36-normal.png';vartypes=['label','properties'];visionClient.detect(img,types,function(err,detection,apiResponse){// console.log(detection['labels']);// console.log(detection['properties']['colors']);if(err)throwerrconsole.log(JSON.stringify(apiResponse,null,2))});
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)
{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 err is:
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)
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 google-cloud@0.45.2: 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/vision
I 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 that 500 error.
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.
Activity
talkaboutdesign commentedon Mar 15, 2017
Here is the error I get.
FYI this is running on local machine.
stephenplusplus commentedon Mar 15, 2017
The API is returning an error for that image:
To access this error:
I know that's pretty goofy, but the layering of
erris:labels)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.
talkaboutdesign commentedon Mar 15, 2017
Thank you. That helps.
talkaboutdesign commentedon Mar 15, 2017
Is it possible to send base64 encoded image through the detect api in node instead of file name?
stephenplusplus commentedon Mar 15, 2017
Yep, if provided as a buffer, either like:
Here's an example with
request:Jasonspd commentedon Apr 12, 2017
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 google-cloud@0.45.2: 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.
sthielen commentedon Jul 15, 2017
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.
Revert "fix: correct STORAGE_EMULATOR_HOST handling (#2069, #1314) (#…
observability: add base for instrumentation + tests (#2097)
observability: add SessionPool span annotations (#2101)
feat: (observability) add spans for BatchTransaction and Table (#2115)
feat(observability): trace Database methods (#2119)
feat(observability): trace Transaction (#2122)
Revert "fix: correct STORAGE_EMULATOR_HOST handling (googleapis#2069, g…