0

I'm having exactly the same intermittent 404 issue calling the API from a Google Apps Script as mentioned here: Javascript Fetch returns 404 occasionally

Should this be reported to Google for assessment and remediation? If so, how? Or is this just something they'll respond "deal with it".

  var videoApiUrl = 'https://videointelligence.googleapis.com/v1/';

  var annotateUrl = videoApiUrl + 'videos:annotate?key=' + apiKey;  

  var testFile = DriveApp.getFileById('11MIdGHM0tYZ5o0p5QebD8uPELYGTntzZ');

  var testBlob = testFile.getBlob();
  var testBase64Bytes = Utilities.base64Encode(testBlob.getBytes());

  var JSON_REQ = XbuildJSONRequestVideoBase64(testBase64Bytes, 'PERSON_DETECTION');
  
  var options = {
    'method': 'post',
    'contentType': 'application/json',
    'muteHttpExceptions': true,
    'payload': JSON_REQ
  };

  var response = UrlFetchApp.fetch(annotateUrl, options);
  var objName = JSON.parse(response);

Result: 404. That's an error. The requested URL yadda-yadda was not found on this server.
That's all we know.

1 Answers1

0

Looks like you may need to implement exponential backoff.

GAS guru Bruce McPherson covered this topic on his site Desktop Liberation.

See post linked below:

Backing off on rate limiting

TheAddonDepot
  • 8,408
  • 2
  • 20
  • 30
  • Thanks for the suggestion about exponential backoff. I don't think it is a quota / resource issue. My requests are single-threaded so I'm not hitting any of these published limits (https://cloud.google.com/video-intelligence/quotas). And the error message I'm getting doesn't resemble any of the resource limit error messages documented. – Tom Scheifler Sep 06 '21 at 02:58
  • @TomScheifler Exponential backoff can also be used to retry failed requests. So in that context it might be of use to you – TheAddonDepot Sep 06 '21 at 13:22
  • agreed. But in this case, a simpler retry at a static interval (e.g. 10 seconds) seems to work since it is not caused by quota. So the original question, still stands. Is it worth reporting and how would I do that? – Tom Scheifler Sep 07 '21 at 14:50