【发布时间】:2020-06-04 00:15:11
【问题描述】:
我不确定这是否是预期的行为,但我是否可以完全依赖它。我有一个 Azure 函数,其中包含多个 Javascript 函数。
看来我可以从其他 Azure 函数调用这些 Javascript 函数。这是预期的,我可以依赖这个吗?
我会用下面的例子来说明这一点
// Azure Function 1 :
testFunctionA = () => {
console.log("This is the 1st function in another azure function");
};
testFunctionB = () => {
console.log("This is the 2nd function in another azure function");
};
testFunctionC = () => {
console.log("This is the 3d function in another azure function");
};
module.exports = {
testFunctionA
};
// Azure function 2:
module.exports = async function (context, req) {
context.log("JavaScript HTTP trigger function processed a request.");
testFunctionA();
testFunctionB();
testFunctionC();
};
调用 HTTP Trigger Azure Function 2 时,输出如下 尽管这两个函数是单独的 Azure 函数:
This is the 1st function in another azure function
index.js:6
This is the 2nd function in another azure function
index.js:10
This is the 3d function in another azure function
【问题讨论】:
-
您能谈谈您的具体需求吗?我认为你不应该这样做。如果function1有问题,function2将无法执行。也许你想要的只是一个像持久功能这样的功能?这是函数链:docs.microsoft.com/en-us/azure/azure-functions/durable/…
-
在 Azure Functions 中,部署和缩放的单位是“函数应用”docs.microsoft.com/en-us/azure/azure-functions/…
-
这是另一个包含多个函数的函数应用程序的文件夹结构示例(其中函数是被触发的东西)docs.microsoft.com/en-us/azure/azure-functions/…。这是你要问的吗?
-
如果是这样,请在此处查看我的答案:stackoverflow.com/questions/51735928/…
-
@BowmanZhu 好吧,我发现这种情况发生的方式是,我有两个不同的 Azure 函数,其中每个都有一个名为“StripeVerification()”的 JavaScript 函数,在调试过程中结束发生的事情是他们正在调用当前函数之外的另一个函数..
标签: azure azure-functions