Firebase Firestore in函数引发有关外部流量的计费错误
我有一个firebase函数,可以在上传图像时创建缩略图。它工作得很好 然后我决定将缩略图URL存储在firestore集合中的适当文档中。我浏览了这些示例,找到了通过admin对象访问firestore的相关代码Firebase Firestore in函数引发有关外部流量的计费错误,firebase,firebase-storage,google-cloud-functions,google-cloud-firestore,Firebase,Firebase Storage,Google Cloud Functions,Google Cloud Firestore,我有一个firebase函数,可以在上传图像时创建缩略图。它工作得很好 然后我决定将缩略图URL存储在firestore集合中的适当文档中。我浏览了这些示例,找到了通过admin对象访问firestore的相关代码 const admin = require("firebase-admin"); admin.initializeApp(functions.config().firebase); // etc return admin.firestore() .coll
const admin = require("firebase-admin");
admin.initializeApp(functions.config().firebase);
// etc
return admin.firestore()
.collection("my-collection")
.doc(colId)
.set({ thumbUrl: fileUrl });
但当我添加此代码时,函数开始失败,并显示以下消息:
未配置计费帐户。外部网络不可访问且
配额受到严格限制。配置帐单帐户以删除这些帐户
限制
我的代码
// before is the upload to bucket that works
.then(() => {
fs.unlinkSync(tempFilePath);
return Promise.all([
tempFilePath.getSignedUrl({
action: "read",
expires: "03-09-2491"
})
]);
})
.then(results => {
console.log("Got thumb signed URL");
const thumbResult = results[0];
const thumbFileUrl = thumbResult[0];
// Add the URLs to the Database
return admin
.firestore()
.collection("my-collection")
.doc(colId)
.set({ thumbUrl: thumbFileUrl });
})
.then(() => console.log("User was updated with thumb url"));
嗯,我知道免费计划只允许外部访问谷歌的内部资料,但我使用的是firestore。。。是谷歌
有什么不对劲吗
firebase管理版本为v5.4.2
当您使用free Spark计划时,firebase功能处于v0.7.1,即使您不尝试进行任何外部访问,这些消息也会出现。该消息只是一个警告,与Firestore无关。请显示其余的代码,因为可能还有其他错误。@DougStevenson编辑了我的问题,看起来不像云函数的完整代码。这是一段代码,所以不可能在这里看到整个过程是如何工作的。@DougStevenson,因为剩下的只是上传到bucket中。不调用任何其他服务,只调用文档示例中的ImageMagick。所以我只加了相关的code@Ros阿拉里奥·费尔南德斯·ImageMagick在谷歌的服务器上运行。它不是外部访问。例如,外部访问可以使用Sengrid发送电子邮件。一些国外的API