Why am I encountering an error when deploying triggers with Pipedream Connect API and how can I resolve it?

This topic was automatically generated from Slack. You can find the original thread here.

Hey, I have a problem deploying some triggers using Pipedream Connect API.
For example GitHub - New Branch Created.
I get this error:

Error: HTTP error! status: 422, body: {"error":"observation error","err":null,"observations":[{"k":"hook","ts":1753804541119,"h":"activate"},{"k":"db.get","ts":1753804541404,"pn":"db","key":"webhookId"},{"k":"error","ts":1753804541405,"err":{"name":"TypeError","message":"Cannot read properties of undefined (reading 'endpoint')","stack":"TypeError: Cannot read properties of undefined (reading 'endpoint')\n    at Object.createWebhook (file:///tmp/__pdg__/dist/code/f1d282cd14107a17b1f017bf260691e8ade37b25d75db017248405cfd65ce3ac/code/sources/common/common-flex.mjs:109:28)\n    at Object.checkWebhookCreation (file:///tmp/__pdg__/dist/code/f1d282cd14107a17b1f017bf260691e8ade37b25d75db017248405cfd65ce3ac/code/sources/common/common-flex.mjs:85:20)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async Object.activate (file:///tmp/__pdg__/dist/code/f1d282cd14107a17b1f017bf260691e8ade37b25d75db017248405cfd65ce3ac/code/sources/common/common-flex.mjs:214:7)\n    at async /var/task/node_modules/@lambda-v2/component-runtime/src/deployedComponentMain.js:78:13\n    at async captureObservations (/var/task/node_modules/@lambda-v2/component-runtime/src/captureObservations.js:28:5)\n    at async deployedComponentMain (/var/task/node_modules/@lambda-v2/component-runtime/src/deployedComponentMain.js:44:20)\n    at async MessagePort.\u003canonymous\u003e (file:///var/task/component_maker.mjs:198:9)"}}]

I suspect that it has to do something with prop $.interface.http , but I am not 100% sure.
Should I be able to deploy these triggers using Connect API and if so, what can be the problem or how to use them properly?

Can you share the payload?

const response = await pd.deployTrigger({
  triggerId: { key: 'github-new-branch' },
  externalUserId: 'UUID',
  configuredProps: {
    github: { authProvisionId: 'apn_XXXXXX' },
    repoFullname: 'vetyy/wkd',
    dynamicPropsId: 'dyp_r4UkzAb'
  },
  webhookUrl: 'https://......ngrok-free.app/api/triggers/UUID'
})

I should have admin permission, as I got this reponse: pipedream/components/github/sources/common/common-flex.mjs at master · PipedreamHQ/pipedream · GitHub
from reload props

{
  "observations": [],
  "errors": [],
  "dynamicProps": {
    "id": "dyp_r4UkzAb",
    "configurableProps": [
      {
        "name": "github",
        "type": "app",
        "app": "github"
      },
      {
        "name": "repoFullname",
        "label": "Repository",
        "description": "The name of the repository (not case sensitive). The format should be `owner/repo` (for example, `PipedreamHQ/pipedream`).",
        "type": "string",
        "remoteOptions": true,
        "reloadProps": true
      },
      {
        "name": "db",
        "type": "$.service.db"
      },
      {
        "name": "http",
        "type": "$.interface.http"
      },
      {
        "name": "docsInfo",
        "type": "alert",
        "alertType": "info",
        "content": "[See the GitHub documentation](https://docs.github.com/en/webhooks/webhook-events-and-payloads#create) for more information on the event format."
      }
    ]
  }
}

Can you try it here in the test app?

If it works there, you can compare the request shape in the Debug tab

It seems that the demo site doesn’t contain all available Triggers.
Demo only contains 20 triggers, but Pipedream UI or Connect API lists 30 triggers.
Not sure based on what demo site filters the triggers?

Yea I think the demo app doesn’t currently paginate through the list of triggers and actions after you select an app, but the above URL should point to the trigger you’re looking at, right? (you can force the selection in URL even if it’s not in the list)

Can you try including a webhook URL?

Okay, it worked now

In case anyone else runs into this issue. It was problem with incorrectly placing dynamicPropsId it suppose to be outside configurationProps. :face_palm: I already did this once. Thanks for your help!

Posted thread to Discourse: Why am I encountering an error when deploying triggers using Pipedream Connect API and how can I fix it?

Legend Matej for documenting the solution, had the same issue and this solved it! :heart_hands: