question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Vision 'detect' not returning values from remote url since 0.90.0

See original GitHub issue

Follow this closed issue #2087 , I tried different versions of vision to see when it starts happening.

I was running vision 0.70.0 and install vision like this:

npm install google-cloud --save
var gcloud = require('google-cloud');
var vision = gcloud.vision();

And it detects remote URL’s like a charm.

Since hearing this way of installing google-cloud is deprecated, I tried installing the bundle @google-cloud/vision. That’s when I encountered the same error as the closed issue. Looking closely, the new install updated my version of vision. I tried 0.70.0 and 0.80.0 which works fine.

From 0.90.0 remote URL detects gives this error:

PartialFailureError: A failure occurred during this request.
    at /Users/jasonluu/Documents/v2/node_modules/@google-cloud/vision/src/index.js:420:15
    at /Users/jasonluu/Documents/v2/node_modules/@google-cloud/vision/src/index.js:121:5
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickDomainCallback (internal/process/next_tick.js:122:9)
errors: 
   [ { code: 500,
       message: 'image-annotator::error(12): We can not access the URL currently. Please download the image and pass it in.',
       type: 'labels' } ] }

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:23 (12 by maintainers)

github_iconTop GitHub Comments

3reactions
stephenpluspluscommented, Jan 7, 2019

@JustinBeckwith @kinwa91 @sduskis – do you think someone from the Vision team should take a look? Multiple users are reporting intermittent success with the same URL. Would you prefer they each got in touch individually with the Vision support team via the methods on their Support page?

2reactions
beccasauruscommented, Apr 9, 2019

When fetching images from HTTP/HTTPS URLs, Google cannot guarantee that the request will be completed. Your request may fail if the specified host denies the request (e.g. due to request throttling or DOS prevention), or if Google throttles requests to the site for abuse prevention. You should not depend on externally-hosted images for production applications.


If you want to use image.source.imageUri in your application, you need to account for the Cloud Vision API occasionally (or frequently, depending on your QPS and the hosts) returning with the error:

We can not access the URL currently. Please download the image and pass it in.

“Why? That sounds broken! I don’t understand!?”

After reading lots of use-cases and user issues, I discovered that it comes down to two limitations:

  1. Being throttled by the website which Cloud Vision is making HTTP requests to for getting the image, which is controlled by the remote host, and avoiding DOS’ing their website
  2. General throttling of the Cloud Vision API endpoint per Quotas and Limits

After some digging around, I found various references to the documentation of the imageUri parameter, from the actual comment on the imageUri:

Screen Shot 2019-04-08 at 5 48 01 PM


Google Cloud Platform logo

To help users in the future who are learning to use the Cloud Vision API, I added this information to the main page which describes how to Make a Request, specifically in the section describing how to provide the image as either a base64-encoded string (image.content) or a URI to an image in Google Cloud Storage or HTTP(S) URL (image.source.imageUri):


Updated website page:

Screen Shot 2019-04-08 at 5 52 51 PM


I hope this helps to explain the reason for these errors!

There are various workarounds which may or may not work for you, depending on your application:

(in no particular order):

  1. Using truncated exponential backoff, which is a standard error handling strategy
    (example implementations)

  2. Provide the image as a base64-encoded string to image.content (base64-encoding instructions for various platforms)

  3. Provide the image from Google Cloud Storage
    (Migrating from Amazon S3 to Cloud Storage may be useful if you choose this route)

Hope this helps!

Read more comments on GitHub >

github_iconTop Results From Across the Web

0.90: Remote UI, Streams, User Groups - Home Assistant
In Firefox it gives me a “The page you are trying to view cannot be shown because the authenticity of the received data...
Read more >
is there a way to easily check if the image url is valid or not?
The most elegant solution is using a XMLHttpRequest and check the response code. If it's 200, the image exists, if it's something different ......
Read more >
Releases - NocoDB Documentation
With Ctrl + C and Ctrl + V , we can copy the data from one cell to another, even to another tables....
Read more >
Bug listing with status CONFIRMED as at 2022/12/26 10:46:31
trapdoor2 (new ebuild)" status:CONFIRMED resolution: severity:enhancement · Bug:56360 - "app-misc/shunt-1.6.3 - restart processes in a pipe without breaking ...
Read more >
/manual.md | std@0.36.0 | Deno
It uses modules referenced as URLs or file paths. Deno does not use package.json in its module resolution algorithm. All async actions in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found