[英]Firebase cloud function cannot deploy functions that call a separate local function
In the context of the docs https://firebase.google.com/docs/cli/?authuser=0#partial_deploys 在文档的上下文中https://firebase.google.com/docs/cli/?authuser=0#partial_deploys
Inside functions/index.js
we have 在
functions/index.js
内部,我们有
var functions = require('firebase-functions');
exports.groupA = {
function1: functions.https.onRequest(...);
function2: functions.database.ref('\path').onWrite(...);
}
exports.groupB = require('./groupB);
Then inside functions/groupB.js
we have: 然后在
functions/groupB.js
内部,我们有:
var functions = require('firebase-functions');
exports.function3 = functions.storage.object().onChange(...);
exports.function4 = functions.analytics.event('in_app_purchase').onLog(...);
However, in my case inside groupB.js
I have another exports.function5
that calls another function local_function
insdie groupB.js 然而,在我的情况里面
groupB.js
我还有一个exports.function5
调用另一个函数local_function
insdie groupB.js
exports.function5 = admin.database.ref(....).onCreate(
event=>{
return local_function()
})
function local_function()
{
return new Promise((resolve,reject)=>{
...
}
}
This failed to deploy to the cloud functions. 这无法部署到云功能。
This doesn't really make sense: 这真的没有道理:
exports.function5 = admin.database.ref(....).onCreate(event=>{
return local_function
})
It's returning a function, which is not helpful for Cloud Functions. 它正在返回一个函数,这对云函数没有帮助。 I think you likely meant to return the result of the calling
local_function
: 我认为您可能打算返回调用
local_function
的结果:
exports.function5 = admin.database.ref(....).onCreate(event=>{
return local_function()
})
This should invoke local_function
and return the promise that it returns. 这应该调用
local_function
并返回它返回的承诺。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.