Node.js 从TypeScript Azure函数调用MS Power Automation
如何从TypeScript Azure函数触发MS Power Automation HTTPtrigger。任何人我一直在尝试,但没有任何运气Node.js 从TypeScript Azure函数调用MS Power Automation,node.js,azure-functions,power-automate,Node.js,Azure Functions,Power Automate,如何从TypeScript Azure函数触发MS Power Automation HTTPtrigger。任何人我一直在尝试,但没有任何运气 const data = JSON.stringify({ todo: 'Buy the milk' }) const options = { hostname: flowUrl, method: 'POST', headers: { 'Content-Type': 'application/j
const data = JSON.stringify({
todo: 'Buy the milk'
})
const options = {
hostname: flowUrl,
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': data.length
}
}
const req = https.request(options, res => {
console.log(`statusCode: ${res.statusCode}`)
res.on('data', d => {
process.stdout.write(d)
})
})
req.on('error', error => {
console.error(error)
})
req.write(data)
req.end()
似乎您只是在
选项中使用了主机名属性,但没有端口和路径属性。我们不能将整个流url放在选项的主机名中,我们需要将其分离为主机名、端口和路径
例如,我的流url是https://prod-06.eastasia.logic.azure.com:443/workflows/e79330xxxxxxxxxxxcf029ac/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=MEAZY9XXXXXXXXXXXXXXXXXXXXPQCWJBCC2MG
,则代码应如下所示:
const options = {
hostname: "prod-06.eastasia.logic.azure.com", //note: do not add "https://" here
method: 'POST',
port: '443',
path: '/workflows/e79330xxxxxxxxxxxcf029ac/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=mEAzy9xxxxxxxxxxxxxxxxxPqCwJBCc2mg',
headers: {
'Content-Type': 'application/json',
'Content-Length': data.length
}
}
更改后,代码可以在my power Automation中触发http触发器。您似乎只在选项中使用了主机名属性,但没有端口和路径属性。我们不能将整个流url放在选项的主机名中,我们需要将其分离为主机名、端口和路径
例如,我的流url是https://prod-06.eastasia.logic.azure.com:443/workflows/e79330xxxxxxxxxxxcf029ac/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=MEAZY9XXXXXXXXXXXXXXXXXXXXPQCWJBCC2MG
,则代码应如下所示:
const options = {
hostname: "prod-06.eastasia.logic.azure.com", //note: do not add "https://" here
method: 'POST',
port: '443',
path: '/workflows/e79330xxxxxxxxxxxcf029ac/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=mEAzy9xxxxxxxxxxxxxxxxxPqCwJBCc2mg',
headers: {
'Content-Type': 'application/json',
'Content-Length': data.length
}
}
更改后,代码可以在我的power Automation中触发http触发器。是否有任何错误消息?是的,我找到了AgeTadrinfo ENOTFOUND,尽管我确信指向我的power Automation Httptrigger的链接是正确的。Hi Nicolai,似乎您不能在选项中仅使用一个属性主机名
。请参考我在下面提供的解决方案。是否有任何错误消息?是的,我找到了AgeTadrinfo ENOTFOUND,尽管我确信指向我的Power Automatic Httptrigger的链接是正确的。Hi Nicolai,似乎您不能在选项中仅使用一个属性主机名
。请参考我在下面提供的解决方案。