Anyone familiar with this gcloud exception:
ApiError: not found in the new util.ApiError (/ site / node_modules / gcloud / lib / common / util.js: 128: 10) in Object.parseHttpRespBody (/site/node_modules/gcloud/lib/common/util.js: 206 : 30) in Object.handleResp (/site/node_modules/gcloud/lib/common/util.js:146:18) at / site / node_modules / gcloud / lib / common / util.js: 447: 12 in Request.onResponse [as _callback] (/site/node_modules/gcloud/node_modules/retry-request/index.js:120:7) in Request.self.callback (/site/node_modules/request/request.js:187:22) in Request .emit (events.js: 98: 17) upon request. (/site/node_modules/request/request.js:1044:10) in Request.emit (events.js: 95: 17) in IncomingMessage. (/site/node_modules/request/request.js:965:12) in IncomingMessage.emit (events.js: 117: 20) in _stream_readable.js: 944: 16 on process._tickDomainCallback (node.js: 492: 13)
He appears only in production (of course) and is currently consistently. It appeared periodically, and the assumption was that it was a @gcloud bug, since locally it could not be played. This is due to the part of the code that uses the simplest gcloud lib method "bucket.upload" without parameters other than the file ... Here is the current function that does this:
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 welcome.
source
share