Akr*_*ion 5 upload buckets node.js google-cloud-platform gcloud-node
任何熟悉此 gcloud 异常的人:
ApiError:在 Object.parseHttpRespBody (/site/node_modules/gcloud/lib/common/util.js:206) 的新 util.ApiError (/site/node_modules/gcloud/lib/common/util.js:128:10) 处找不到: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 [as _callback] (/site/node_modules/gcloud/node_modules/retry-request/index.js:120:7) 在 Request.self.callback (/site/node_modules/request/request.js:187:22) 在请求.emit (events.js:98:17) 在请求。(/site/node_modules/request/request.js:1044:10) 在 Request.emit (events.js:95:17) 在 IncomingMessage 处。(/site/node_modules/request/request.js:965:12) 在 IncomingMessage.emit (events.js:117:20) 在 _stream_read.js:944:16 在 process._tickDomainCallback (node.js:492:13)
它仅出现在生产中(当然)并且目前一致。它曾经定期出现,假设它是 gCloud 的一个小故障,因为它无法在本地重现。它与使用最简单的 gCloud lib 方法的代码部分相关,bucket.upload
除了文件之外没有任何参数......这是执行此操作的当前函数:
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;
});
}
Run Code Online (Sandbox Code Playgroud)
非常感谢任何反馈。
这个错误有点晦涩,但对我来说是正确的。当我在某些情况下尝试写入不存在的 bigquery 表时(我不小心传递了“未定义”作为表名),我收到此错误,我怀疑在幕后发生了一些 404 错误强制。
归档时间: |
|
查看次数: |
2883 次 |
最近记录: |