我按照教程Visual Studio Code quickstart进行操作并在本地创建了一个持久的函数。当我的持久函数在启动函数内执行等待 client.startNew 时,我收到一条错误消息
const instanceId = await client.startNew(req.params.functionName, undefined, req.body);
这是错误消息:
Executed 'Functions.HttpTrigger' (Failed, Id=84dc103d-bef9-4450-b4c6-9e612c6dc263) System.Private.CoreLib: Exception while executing function: Functions.HttpTrigger. System.Private.CoreLib: Result: Failure Exception: Error: write EPROTO 101057795:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:openssl\ssl\s23_clnt.c:827: Stack: Error: write EPROTO 101057795:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:openssl\ssl\s23_clnt.c:827: at _errnoException (util.js:992:11) at WriteWrap.afterWrite [as oncomplete] (net.js:864:14).
我的环境:
- Azure Functions 核心工具 (2.3.148)
- 函数运行时版本(2.0.12210.0)
- Node.js 8
这是我刚刚从教程中复制的代码。
const df = require("durable-functions");
module.exports = async function (context, req) {
const client = df.getClient(context);
const instanceId = await client.startNew(req.params.functionName, undefined, req.body);
context.log(`Started orchestration with ID = '${instanceId}'.`);
return client.createCheckStatusResponse(context.bindingData.req, instanceId);
};
<小时/>
{
"bindings": [
{
"authLevel": "anonymous",
"name": "req",
"type": "httpTrigger",
"direction": "in",
"route": "orchestrators/{functionName}",
"methods": ["post"]
},
{
"name": "$return",
"type": "http",
"direction": "out"
},
{
"name": "starter",
"type": "orchestrationClient",
"direction": "in"
}
]
}
如何解决这个问题?
最佳答案
更新
自 npm 包 durable-functions
v1.1.3 以来,该问题已得到修复
您遇到了known issue .
This is due to current IWebHookProvider implementation, which causes the DurableOrchestrationClient class to use the wrong webhook URLs. The workaround is to set local environment variable WEBSITE_HOSTNAME to localhost:, ex. localhost:7071
如果在设置 env 之前已经打开 VS Code,请不要忘记重新启动它以使新的 env 变量生效。
关于node.js - 无法通过 Visual Studio Code 在本地运行 Azure Durable Function,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53812188/