4
votes

Anyone familiar with this gcloud exception:

ApiError: Not Found at new util.ApiError (/site/node_modules/gcloud/lib/common/util.js:128:10) at Object.parseHttpRespBody (/site/node_modules/gcloud/lib/common/util.js:206:30) at Object.handleResp (/site/node_modules/gcloud/lib/common/util.js:146:18) at /site/node_modules/gcloud/lib/common/util.js:447:12 at Request.onResponse [as _callback] (/site/node_modules/gcloud/node_modules/retry-request/index.js:120:7) at Request.self.callback (/site/node_modules/request/request.js:187:22) at Request.emit (events.js:98:17) at Request. (/site/node_modules/request/request.js:1044:10) at Request.emit (events.js:95:17) at IncomingMessage. (/site/node_modules/request/request.js:965:12) at IncomingMessage.emit (events.js:117:20) at _stream_readable.js:944:16 at process._tickDomainCallback (node.js:492:13)

It appears only in production (of course) and currently consistently. It used to appear periodically and the assumption was that it is a glitch @ gCloud since locally it could not be reproduced. It is related to the part of the code which uses the simplest gCloud lib method bucket.upload with no parameters other than the file ... Here is the current function which does it:

function uploadToGoogleCloud(filePath, makePublic) {
  var gstorage = gcloud.storage({
    projectId: EXAMPLE_projectId,
    credentials: EXAMPLE_credentials,
  });

  var spBucket = Promise.promisifyAll(gstorage.bucket(EXAMPLE_bucket));

  return spBucket.uploadAsync(filePath).then(function(file) {
    if (makePublic) {
      var fileAsync = Promise.promisifyAll(file);
      return fileAsync.makePublicAsync().then(function() {
        return file;
      });
    }
    return file;
  });
}

Any feedback is greatly appreciated.

1
So it appears that the files are actually being uploaded but not made public. Hoping that would help with some suggestions. We are still trying to resolve this.Akrion
The GCS API error reporting is a joke. They provide no details as to what's going wrong. Drives me nuts.Tyguy7
@Akrion were you able to solve this issue? Does any of the other solutions here or here work for you? If so providing your solution here will better help the community.Jordan

1 Answers

0
votes

The error is a bit obscure, but was correct for me. I got this error when I in some cases were trying to write to a bigquery table that did not exist (I accidentally passed "undefined" as the tablename), I suspect that there is some 404 error coercion going on under the hood.