Hello everyone, How are you? Today I've upgraded ...
# ask-community
o
Hello everyone, How are you? Today I've upgraded my prefect package from 3.0.3 to 3.0.7 and many things broke: 1. UI stopped displaying the Work Pools 2. Can't create new Work Pools from the UI (the different type are not available - see image) 3. When trying to work with the python library (that wraps the API) I keep getting
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
errors. What is the most reliable version currently? Few examples of use with errors: 1. When trying to deploy a flow to a None existing Work Pool the the server doesn't return 404 error from the address but 200 with HTML page of 404:
File "/workspaces/prefect-poc/.venv/lib/python3.11/site-packages/prefect/client/orchestration.py", line 2658, in read_work_pool return WorkPool.model_validate(response.json()).
The server returns an HTML in response to the request:
Copy code
'<!DOCTYPE html>\n<html lang="en">\n  <head>\n    <meta charset="UTF-8" />\n    <link rel="apple-touch-icon" sizes="180x180" href="/ico/apple-touch-icon.png">\n    \n   \n    \n    <link rel="icon" id="favicon-32" type="image/png" sizes="32x32" href="/ico/favicon-32x32.png" media="(prefers-color-scheme:light)">\n    <link rel="icon" id="favicon-16" type="image/png" sizes="16x16" href="/ico/favicon-16x16.png" media="(prefers-color-scheme:light)">\n\n    <link rel="icon" id="favicon-32-dark" type="image/png" sizes="32x32" href="/ico/favicon-32x32-dark.png" media="(prefers-color-scheme:dark)">\n    <link rel="icon" id="favicon-16-dark" type="image/png" sizes="16x16" href="/ico/favicon-16x16-dark.png" media="(prefers-color-scheme:dark)">\n    \n    <link rel="icon" href="/favicon.ico" media="(prefers-color-scheme:no-preference)">\n    <link rel="icon" href="/favicon.ico" media="(prefers-color-scheme:light)">\n    <link rel="icon" href="/favicon-dark.ico" media="(prefers-color-scheme:dark)">\n\n    <link rel="manifest" href="/ico/site.webmanifest">\n    <link rel="mask-icon" href="/ico/safari-pinned-tab.svg" color="#5bbad5">\n    \n    <meta name="msapplication-TileColor" content="#da532c">\n    <meta name="theme-color" content="#ffffff">\n\n    <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n    <title>Prefect Server</title>\n    <script type="module" crossorigin src="/assets/index-DGGjalVM.js"></script>\n    <link rel="stylesheet" crossorigin href="/assets/index-0K-9VP3A.css">\n  </head>\n  <body>\n    <div id="app"></div>\n  </body>\n</html>\n'
The code that gets the error:
Copy code
flow.from_source(
        source=str(Path(__file__).parent),
        entrypoint="prefect_create_deployment.py:test_flow",
    ).deploy(
        name="print-deployment-k8s-process",
        work_pool_name="Process Worker",  # Work pool target
        triggers=[
            events.DeploymentEventTrigger(
                name="Print Trigger",
                enabled=True,
                match={},
                expect=["Run Deployment Process"],
                parameters={
                    "event_details": "{{ event.payload }}",
                },
            )
        ],
    )
2. When trying to work with
prefect.client.orchestration.get_client
with the function
create_work_pool
for some reason the client creates the following request:
Copy code
<Request('GET', '<http://127.0.0.1:4200/csrf-token?client=6bd93e79-f5a8-46b2-b99f-b88891b2d3e0>')>
Which get the 200 response (seems like the 404):
Copy code
'<!DOCTYPE html>\n<html lang="en">\n  <head>\n    <meta charset="UTF-8" />\n    <link rel="apple-touch-icon" sizes="180x180" href="/ico/apple-touch-icon.png">\n    \n   \n    \n    <link rel="icon" id="favicon-32" type="image/png" sizes="32x32" href="/ico/favicon-32x32.png" media="(prefers-color-scheme:light)">\n    <link rel="icon" id="favicon-16" type="image/png" sizes="16x16" href="/ico/favicon-16x16.png" media="(prefers-color-scheme:light)">\n\n    <link rel="icon" id="favicon-32-dark" type="image/png" sizes="32x32" href="/ico/favicon-32x32-dark.png" media="(prefers-color-scheme:dark)">\n    <link rel="icon" id="favicon-16-dark" type="image/png" sizes="16x16" href="/ico/favicon-16x16-dark.png" media="(prefers-color-scheme:dark)">\n    \n    <link rel="icon" href="/favicon.ico" media="(prefers-color-scheme:no-preference)">\n    <link rel="icon" href="/favicon.ico" media="(prefers-color-scheme:light)">\n    <link rel="icon" href="/favicon-dark.ico" media="(prefers-color-scheme:dark)">\n\n    <link rel="manifest" href="/ico/site.webmanifest">\n    <link rel="mask-icon" href="/ico/safari-pinned-tab.svg" color="#5bbad5">\n    \n    <meta name="msapplication-TileColor" content="#da532c">\n    <meta name="theme-color" content="#ffffff">\n\n    <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n    <title>Prefect Server</title>\n    <script type="module" crossorigin src="/assets/index-DGGjalVM.js"></script>\n    <link rel="stylesheet" crossorigin href="/assets/index-0K-9VP3A.css">\n  </head>\n  <body>\n    <div id="app"></div>\n  </body>\n</html>\n'
And again the client fails to get the json from the response in the line:
CsrfToken = CsrfToken.model_validate(token_response.json())
So which version should I work with? (had the same with 3.0.6) Any recommendations? Should I reimplement my own Rest API client and should work with the python client?
Sharing for future usage. The latest version that the UI works with work pool is 3.0.4. As for the client being broken, the URL in the env should include the full api url as follows:
PREFECT_API_URL=<http://localhost:4200/api>
I defined it as so kept getting 404 (as html) which broke the httpx
PREFECT_API_URL=<http://localhost:4200>
Sorry for that 🥴
n
hi @Oz Shaked im aware of an issue with 3.0.7 that I am working on resolving now, which is likely related to these things you're seeing, but are you able to confirm that 3.0.5 did not work?