Closed schodge closed 1 year ago
Thanks for the writeup and checking into the existing issues! We'll try to get this squared away shortly.
@schodge Can you confirm which endpoint you're using?
From the API reference:
https://api.prefect.cloud/api/accounts/45545742.../workspaces/695fb847.../flow_runs/"
In some of the help material, there's a different URL, but I didn't find that to work:
https://discourse.prefect.io/t/how-to-connect-to-prefect-cloud-2-0-restapi/1627/2
https://api.prefect.cloud/api/accounts/45545742.../deployments/24583f30.../create_flow_run
(truncating all the uuids)
Was it this API reference? https://app.prefect.cloud/api/docs . We may need to update our links somewhere if we have conflicting reference docs.
Here's the format that you should be using:
https://api.prefect.cloud/api/accounts/{account_id}/workspaces/{workspace_id}/deployments/{id}/create_flow_run
Here's more information on the body that this endpoint expects: https://app.prefect.cloud/api/docs#tag/Deployments/operation/create_flow_run_from_deployment_api_accounts__account_id__workspaces__workspace_id__deployments__id__create_flow_run_post
It appears the problem is there is what you just mentioned - there is a create flow run from deployment at an endpoint of create_flow_run
, and a create flow run and flow_runs
@schodge it'd be really helpful if you constructed an executable minimal reproducible example that demonstrates your problem. If we cannot copy and paste it to run it, we cannot attempt to reproduce and debug your problem.
I added coverage for this in a test and it succeeds https://github.com/PrefectHQ/prefect/pull/8203
@schodge I see where that's causing the confusion. Next time the minimum reproducible example will definitely help us diagnose a bit faster. I'll check with the team about seeing if there might be a way to clarify that in our docs.
Does it resolve the issue when you use the deployments endpoint?
Yes, changing the endpoint fixed it. Thanks for the help!
How about removing the POST /api/flow_runs
endpoint altogether? That would make it clear that we are to use the POST /api/deployments/DEPLOYMENT_ID/create_flow_run
endpoint.
First check
Bug summary
I talked with two Prefect solutions engineers just now, and they suggested this could be a REST API bug. Looking at the backlog, it may be the same as https://github.com/PrefectHQ/prefect/issues/6619
We're using the REST API to verify the pipelines are working correctly in Prefect 2 alongside Prefect 1 as part of our migration since we can't use both clients simultaneously; this issue is blocking our migration.
We've set up a deployment. The deployment has a work queue attached. We've verified we can execute the flow from the UI and it works.
We send a REST flow run POST.
(identical behavior via Postman as Python)
We get back a result (see the error box)
There's no work queue populated. The task shows up in the UI without a work queue. Compare below, with the top run submitted via REST and having no work queue and the run below it submitted via the API and having a work queue.
There are no logs whatsoever for the REST runs. There are normal logs for the UI triggered runs.
Reproduction
Error
Additional context
No response