Power Platform自定义连接器在流动中起作用,但在Canvas应用程序中不行

发布于 2025-02-10 04:16:56 字数 2662 浏览 0 评论 0原文

我有一个自定义连接器,可完全适用于我构建的任何流程。当我尝试在帆布应用中使用相同的连接器时,似乎没有发生任何事情。也没有错误消息,监视器指示成功:

{
    "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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

铁轨上的流浪者 2025-02-17 04:16:57

事实证明,问题不一定与Canvas应用程序有关,而是与后端,这是Azure API管理实例。我调整了API的CORS设置,以允许获得和选项方法,这解决了问题。

对于将来的参考,请尝试以下解决方案:

<cors allow-credentials="false">
    <allowed-origins>
        <origin>*</origin>
    </allowed-origins>
    <allowed-methods>
        <method>*</method>
    </allowed-methods>
    <allowed-headers>
        <header>*</header>
    </allowed-headers>
</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:

<cors allow-credentials="false">
    <allowed-origins>
        <origin>*</origin>
    </allowed-origins>
    <allowed-methods>
        <method>*</method>
    </allowed-methods>
    <allowed-headers>
        <header>*</header>
    </allowed-headers>
</cors>

If that works, you can obviously fine-tune the settings afterwards.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文