Node.js gcloud错误:ApiError:在new util.ApiError中找不到
熟悉此gcloud异常的任何人: APIRROR:在new util.APIRROR中找不到 (/site/node_modules/gcloud/lib/common/util.js:128:10) Object.parseHttpRespBody (/site/node_modules/gcloud/lib/common/util.js:206:30) Object.handleResp (/site/node_modules/gcloud/lib/common/util.js:146:18) /site/node_modules/gcloud/lib/common/util.js:447:12在 Request.onResponse[作为回调] (/site/node_modules/gcloud/node_modules/retry request/index.js:120:7) 应请求。自动回拨 (/site/node_modules/request/request.js:187:22)at request.emit (events.js:98:17)应请求。 (/site/node_modules/request/request.js:1044:10)at request.emit (events.js:95:17)在IncomingMessage。 (/site/node_modules/request/request.js:965:12)位于IncomingMessage.emit (events.js:117:20)at_stream_readable.js:944:16 at 进程._tickDomainCallback(node.js:492:13) 它只出现在生产中(当然),而且目前一直持续。它过去经常定期出现,人们认为它是gCloud的一个小故障,因为它在本地无法复制。它与代码中使用最简单的gCloud lib方法Node.js gcloud错误:ApiError:在new util.ApiError中找不到,node.js,upload,google-cloud-platform,gcloud-node,buckets,Node.js,Upload,Google Cloud Platform,Gcloud Node,Buckets,熟悉此gcloud异常的任何人: APIRROR:在new util.APIRROR中找不到 (/site/node_modules/gcloud/lib/common/util.js:128:10) Object.parseHttpRespBody (/site/node_modules/gcloud/lib/common/util.js:206:30) Object.handleResp (/site/node_modules/gcloud/lib/common/util.js:146:18
bucket的部分有关。上传
,除了文件之外,没有其他参数。。。以下是执行此操作的当前函数:
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;
});
}
非常感谢您的反馈。错误有点模糊,但对我来说是正确的。在某些情况下,当我试图写入一个不存在的bigquery表(我意外地将“undefined”传递为tablename)时,我得到了这个错误,我怀疑有404错误强制正在后台进行 因此,看起来这些文件实际上正在上传,但并未公开。希望这能给你一些建议。我们仍在努力解决这个问题。GCS API错误报告是一个笑话。他们没有提供出什么问题的细节。让我发疯。@Akrion你能解决这个问题吗?其他的解决方案或方法对你有用吗?如果是这样,在这里提供您的解决方案将更好地帮助社区。