Power Platform自定义连接器在流动中起作用,但在Canvas应用程序中不行
我有一个自定义连接器,可完全适用于我构建的任何流程。当我尝试在帆布应用中使用相同的连接器时,似乎没有发生任何事情。也没有错误消息,监视器指示成功:
{
"status": 200,
"duration": 311.5,
"dataSource": "DS",
"responseSize": 0,
"controlName": "btnSendToDS",
"propertyName": "OnSelect",
"nodeId": 16,
"formulaData": {
"script": "",
"spanStart": null,
"spanEnd": null
},
"data": {
"context": {
"entityName": "btnSendToDS",
"propertyName": "OnSelect",
"nodeId": 16,
"id": 343,
"diagnosticContext": {
"dataOperation": {
"protocol": "rest",
"operation": "upsertTask",
"dataSource": "DS"
}
}
},
"request": {
"url": "https://europe-002.azure-apim.net/apim/dime-2escheduler-20import-5fa42ba8c1798e4bb5-5ffc65ed5301df6bbf/949038e657344d26be8687bfb0eddb41/task",
"method": "POST",
"headers": {
"x-ms-pa-client-telemetry-options": "paclient-telemetry {\"operationName\":\"/providers/microsoft.powerapps/apis/shared_dime-2escheduler-20import-5fa42ba8c1798e4bb5-5ffc65ed5301df6bbf.upsertTask\"}",
"ServiceNamespace": "DS",
"Content-Type": "application/json"
},
"body": {
"sourceApp": "POWERAPPS",
"sourceType": "POWERAPPS",
"jobNo": "POWERAPP_001",
"taskNo": "DRUNKER_SAILOR",
"shortDescription": "What shall we do?",
"description": "What shall we do?"
}
},
"response": {
"duration": 311.5,
"size": 0,
"status": 200,
"headers": {
"Content-Length": 0,
"Date": "Thu, 23 Jun 2022 09:12:07 GMT",
"x-ms-apihub-cached-response": false,
"x-ms-apihub-obo": true
},
"body": "",
"responseType": "pabinary"
},
"startTime": 12581.6,
"name": "https://europe-002.azure-apim.net/invoke",
"fetchStart": 12606.1,
"responseEnd": 12888.4,
"nextHopProtocol": ""
}
}
自定义连接器只需调用Azure API管理终点点,但是根据此服务中的分析/日志,它永远不会到达那里。
它确实与PowerApp有关,因为如果我通过流程运行相同的端点,则适用于API。在按钮的OnSelect事件中,这是我称之为的代码:
'DS'.Task(
{
'ds-append': true,
sourceApp: "POWERAPPS",
sourceType: "POWERAPPS",
jobNo: "POWERAPP_001",
taskNo: tblTasks.Selected.Id,
shortDescription: tblTasks.Selected.Description,
description: tblTasks.Selected.Description
}
);
这里有什么我缺少的吗?
I've got a custom connector that works perfectly for any kind of flow I've built. When I try to use the same connector in a canvas app, nothing seems to happen. There are no error messages either and the monitor indicates success:
{
"status": 200,
"duration": 311.5,
"dataSource": "DS",
"responseSize": 0,
"controlName": "btnSendToDS",
"propertyName": "OnSelect",
"nodeId": 16,
"formulaData": {
"script": "",
"spanStart": null,
"spanEnd": null
},
"data": {
"context": {
"entityName": "btnSendToDS",
"propertyName": "OnSelect",
"nodeId": 16,
"id": 343,
"diagnosticContext": {
"dataOperation": {
"protocol": "rest",
"operation": "upsertTask",
"dataSource": "DS"
}
}
},
"request": {
"url": "https://europe-002.azure-apim.net/apim/dime-2escheduler-20import-5fa42ba8c1798e4bb5-5ffc65ed5301df6bbf/949038e657344d26be8687bfb0eddb41/task",
"method": "POST",
"headers": {
"x-ms-pa-client-telemetry-options": "paclient-telemetry {\"operationName\":\"/providers/microsoft.powerapps/apis/shared_dime-2escheduler-20import-5fa42ba8c1798e4bb5-5ffc65ed5301df6bbf.upsertTask\"}",
"ServiceNamespace": "DS",
"Content-Type": "application/json"
},
"body": {
"sourceApp": "POWERAPPS",
"sourceType": "POWERAPPS",
"jobNo": "POWERAPP_001",
"taskNo": "DRUNKER_SAILOR",
"shortDescription": "What shall we do?",
"description": "What shall we do?"
}
},
"response": {
"duration": 311.5,
"size": 0,
"status": 200,
"headers": {
"Content-Length": 0,
"Date": "Thu, 23 Jun 2022 09:12:07 GMT",
"x-ms-apihub-cached-response": false,
"x-ms-apihub-obo": true
},
"body": "",
"responseType": "pabinary"
},
"startTime": 12581.6,
"name": "https://europe-002.azure-apim.net/invoke",
"fetchStart": 12606.1,
"responseEnd": 12888.4,
"nextHopProtocol": ""
}
}
The custom connector simply invokes an Azure API Management endpoint, but it never gets there, according to the analytics/logs in this service.
It really has to do with the PowerApp, because if I run the same endpoint through a Flow, the API is called correctly. On the OnSelect event of a button, this is the code I call:
'DS'.Task(
{
'ds-append': true,
sourceApp: "POWERAPPS",
sourceType: "POWERAPPS",
jobNo: "POWERAPP_001",
taskNo: tblTasks.Selected.Id,
shortDescription: tblTasks.Selected.Description,
description: tblTasks.Selected.Description
}
);
Is there anything I'm missing here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,问题不一定与Canvas应用程序有关,而是与后端,这是Azure API管理实例。我调整了API的CORS设置,以允许获得和选项方法,这解决了问题。
对于将来的参考,请尝试以下解决方案:
如果可行,则显然可以在之后微调设置。
It turns out the problem wasn't necessarily related to the canvas app but to the backend, which is an Azure API Management instance. I adjusted the CORS settings of the API to allow GET and OPTIONS methods and that solved the problem.
For future reference, try out the following solution:
If that works, you can obviously fine-tune the settings afterwards.