When registering flows to Prefect Server I got an error "GRAPHQL_VALIDATION_FAILED: Unknown type "register_tasks_input""

View in #prefect-server on Slack

Chris_Duke @Chris_Duke: I’ve trying to register flows locally programmatically and getting an error on one flow:

Traceback (most recent call last):
  File "/helix_orchestration/flows/reporting/fhir_rpt_reporting_pipeline.py", line 191, in <module>
    flow.register(project_name="helix", idempotency_key=flow.serialized_hash())
  File "/usr/local/lib/python3.7/site-packages/prefect/core/flow.py", line 1734, in register
    idempotency_key=idempotency_key,
  File "/usr/local/lib/python3.7/site-packages/prefect/client/client.py", line 1211, in register
    variables=dict(input=inputs),
  File "/usr/local/lib/python3.7/site-packages/prefect/client/client.py", line 554, in graphql
    retry_on_api_error=retry_on_api_error,
  File "/usr/local/lib/python3.7/site-packages/prefect/client/client.py", line 458, in post
    retry_on_api_error=retry_on_api_error,
  File "/usr/local/lib/python3.7/site-packages/prefect/client/client.py", line 738, in _request
    session=session, method=method, url=url, params=params, headers=headers
  File "/usr/local/lib/python3.7/site-packages/prefect/client/client.py", line 660, in _send_request
    raise ClientError(f"{exc}\n{graphql_msg}") from exc
prefect.exceptions.ClientError: 400 Client Error: Bad Request for url: <http://apollo:4200/>

The following error messages were provided by the GraphQL server:    GRAPHQL_VALIDATION_FAILED: Unknown type "register_tasks_input". Did you mean
        "register_agent_input", "delete_agent_input", "delete_flow_input",
        "delete_tenant_input", or "log_insert_input"?
    GRAPHQL_VALIDATION_FAILED: Cannot query field "register_tasks" on type
        "Mutation". Did you mean "register_agent", "delete_task", "insert_task", or "update_task"?

I’m not sure what this error is indicating as i have other flows that register fine using this same register call and similar setup. I’m running this locally using docker image on version 0.15.10

Kevin_Kho @Kevin_Kho: Only on one flow? There seems to be a version mismatch somewhere. What is the version of the Server?

Chris_Duke @Chris_Duke: I have close to 100 - some produce this errors others dont but all have very similar lines

"hasura/graphql-engine:v1.3.3"
"prefecthq/server:2021.04.06"
"prefecthq/apollo:2021.04.06"
prefecthq/ui:2021-04-15
prefecthq/prefect:0.15.10

those are the versions we have in our docker compose file

Kevin_Kho @Kevin_Kho: This all look good. How about the place you are registering from?

Chris_Duke @Chris_Duke: runnin from the agent server - prefecthq/prefect:0.15.10
i.e. i do a docker cp && docker exec on the file im trying to register

Kevin_Kho @Kevin_Kho: This looks like it should work. Are you using flow.register()?

Chris_Duke @Chris_Duke: yep my full command is:

flow.register(project_name="helix", idempotency_key=flow.serialized_hash())

where helix is a registered project name

Anna_Geller @Anna_Geller: Can you try to manually trigger DB migration? something is wrong with your backend:

docker exec graphqlContainerName prefect-server database upgrade -y

Note that after running DB migrations manually, you need to restart your Apollo container so that it can refetch the updated database schemas:

docker restart apolloContainerName

before doing that, maybe create a backup of your Postgres instance just in case :slightly_smiling_face:
and btw, perhaps migrating to the latest version would help? this way you could sort of start from scratch and ensure all your components use the latest and the same version

I would also be curious to see the flow definition that led to that error - what storage and agent do you use? can you send the output of “prefect diagnostics”?

Chris_Duke @Chris_Duke: im trying to create a localized docker setup for testing purposes - normally we use Prefect cloud hosted and that worked fine when i register_flow gets called from an agent
so it registers the flow but still throws that error - im not sure where prefect diagnotics is run at or where i can get that output?

Kevin_Kho @Kevin_Kho: You can run it in the CLI wherever you register from prefect diagnostics

Chris_Duke @Chris_Duke:

{
  "config_overrides": {
    "backend": true,
    "server": {
      "host": true
    }
  },
  "env_vars": [],
  "system_information": {
    "platform": "Linux-5.10.76-linuxkit-x86_64-with-debian-11.1",
    "prefect_backend": "server",
    "prefect_version": "0.15.10",
    "python_version": "3.7.12"
  }
}