<@ULVA73B9P> i'm trying to deploy a flow using .se...
# ask-marvin
g
@Marvin i'm trying to deploy a flow using .serve() but after upgrading to 3.x i'm receiving this error:
Copy code
prefect.deployments.runner.DeploymentApplyError: Error while applying deployment: Client error '422 Unprocessable Entity' for url '<http://localhost:4200/api/deployments/>'
Response: {'exception_message': 'Invalid request received.', 'exception_detail': [{'type': 'extra_forbidden', 'loc': ['body', 'infra_overrides'], 'msg': 'Extra inputs are not permitted', 'input': {}}, {'type': 'extra_forbidden', 'loc': ['body', 'manifest_path'], 'msg': 'Extra inputs are not permitted', 'input': None}
m
The error you're encountering,
422 Unprocessable Entity
, often occurs due to Prefect 3.x's stricter handling of deployment parameters. Specifically, the
infra_overrides
and
manifest_path
fields are not recognized in the context you're attempting to use them. Here are some key points to address this issue: 1. Work Pools and Job Variables: Prefect 3.x uses work pools and job variables for infrastructure configuration. Ensure that you are using the correct fields for your deployment. The fields like
infra_overrides
and
manifest_path
are not valid inputs in Prefect 3.x deployments. You should instead focus on using
job_variables
to customize infrastructure settings. 2. Deployment Method: Ensure you are using the correct deployment method. Prefect 3.x recommends using the
from_source
method for deployments, and you should configure your deployment using a
prefect.yaml
file or the Python deployment method. 3. Review Documentation: Review the Prefect 3.x deployment documentation to ensure you are following the updated practices for defining and deploying flows. 4. GitHub Issues: There are related issues on GitHub, such as this one, which discuss similar errors. These might provide additional insights or workarounds specific to your use case. 5. Common 3.x Gotchas: Prefect 3.x has several changes from 2.x, such as the replacement of agents with workers and the introduction of work pools. Make sure your deployment process aligns with these changes. You may need to refactor your deployment configuration to adhere to these new standards in Prefect 3.x. If you have specific configurations you need help translating, feel free to share them.
d
Make sure your prefect version between the server and the flow's environment match
upvote 1
g
how can i check that?
d
In both environments there's a
prefect version
command available
g
both are in 3.1.11
n
are you specifying
infra_overrides
in your code anywhere? if you did have the right versions and you were using that instead of the new alias (job_variables) then this might also happen
g
hm... i've found some infra_overrides parameters in some yamls of the project, that could be it, i'll investigate that, thanks
n
yep! you should be able to just replace all instances of that with
job_variables
directly
g
thanks for that!
that wasn't the issue apparently
d
Is it the same error?
g
yeah
in the prefect.yaml i'm already using job_variables as a parameter
d
how about
manifest_path
?
g
no, only on old files outside of the prefect.yaml
i see more parameters on the full error
this is the full response:
Copy code
Response: {'exception_message': 'Invalid request received.', 'exception_detail': [{'type': 'extra_forbidden', 'loc': ['body', 'infra_overrides'], 'msg': 'Extra inputs are not permitted', 'input': {}}, {'type': 'extra_forbidden', 'loc': ['body', 'manifest_path'], 'msg': 'Extra inputs are not permitted', 'input': None}, {'type': 'extra_forbidden', 'loc': ['body', 'schedule'], 'msg': 'Extra inputs are not permitted', 'input': None}], 'request_body': {'infra_overrides': {}, 'name': 'metal', 'flow_id': '18618ee8-f2cc-4a89-9db3-28792647185f', 'paused': False, 'schedules': [], 'enforce_parameter_schema': False, 'parameter_openapi_schema': {'title': 'Parameters', 'type': 'object', 'properties': {}}, 'parameters': {}, 'tags': [], 'manifest_path': None, 'work_queue_name': None, 'storage_document_id': None, 'infrastructure_document_id': None, 'schedule': None, 'description': None, 'path': '.', 'version': '0b22fdd21939f5ed92e9627cfebabd16', 'entrypoint': 'flows/metal/flow.py:metal_pipeline'}}
its weird, i see the schedule parameter on my prefect.yaml file but idk if this should affect a local run of the flow using serve, where do i set these parameters in the first place?
n
something is weird here
Copy code
'manifest_path': None, 'storage_document_id': None, 'infrastructure_document_id': None,
all three of these are completely removed in 3.x, which makes me think you have a
Deployment.build_from_flow
or other some 2.x style deployment definition somewhere
g
this is how i'm trying to deploy my flow:
Copy code
if __name__ == "__main__":
    metal_pipeline()
    metal_pipeline.serve(name="metal")
this was the way i saw on the 3.x docs, but i was already using it on 2.x as well
hey guys, i got it working properly now, turns out my prefect installation was all weird, i used python 3.9 to install my prefect locally and that may have affected some packages in prefect 3 idk, but now i've reinstalled everything using python 3.11 and got .serve() working as expected