Hey, I’m running into an issue with Prefect 2.x an...
# prefect-cloud
j
Hey, I’m running into an issue with Prefect 2.x and could use some help. What I’m Doing: Creating flow runs via the Prefect API** using this endpoint:
Copy code
POST <https://api.prefect.cloud/api/accounts/{account_id}/workspaces/{workspace_id}/flow_runs>
- Here’s an example of the API request I’m making:
Copy code
curl -X POST "<https://api.prefect.cloud/api/accounts/{account_id}/workspaces/{workspace_id}/flow_runs>" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
        "flow_id": "your_flow_id",
        "parameters": {
         
        }
      }'
What I Expect: - When I trigger a flow run via the API, it should get assigned to the correct work pool and queue, and the worker should pick it up and run it, just like it does when triggered through the Prefect Cloud dashboard. The Issue: - When I create a flow run through the dashboard**, it’s picked up by the worker and runs perfectly. - But when I create a flow run via the API**, it stays in a
Pending
state and doesn’t get picked up by the worker. What’s Working: - Flow runs triggered from the dashboard work as expected. What’s Not Working: - Flow runs created via the API aren’t being picked up by the worker. Any ideas on what might be going wrong? I’ve confirmed that the worker is running and polling the correct work queue, so I’m wondering if the flow run isn’t being properly associated with the work pool/queue when created via the API. Any help would be appreciated! Thanks!
n
hi @Jonatan Camarena
POST /flow_runs
isn't quite what you want here i dont think (which admittedly is a bit counterintuitive), since that will create the flow run in the db, but agnostic to the deployment that contains the info it seems to actually execute in your runtime I think you'll want this one
j
Thanks