Hello Team, I created flow, which schedules other ...
# prefect-community
v
Hello Team, I created flow, which schedules other flows, using
StartFlowRun
, when I run it locally, everything is working fine, but, when it executed in k8s container, which is running by schedule it fails
1
Copy code
Traceback (most recent call last):
  File "/root/.prefect/runner/flows/lazarus/load_jobs.py", line 97, in run
    self.__schedule(
  File "/root/.prefect/runner/flows/lazarus/load_jobs.py", line 77, in __schedule
    flow_run.run(idempotency_key=custom_name)
  File "/usr/local/lib/python3.8/site-packages/prefect/utilities/tasks.py", line 449, in method
    return run_method(self, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/prefect/tasks/prefect/flow_run.py", line 172, in run
    run_link = client.get_cloud_url("flow-run", flow_run_id)
  File "/usr/local/lib/python3.8/site-packages/prefect/client/client.py", line 895, in get_cloud_url
    tenant_slug = self.get_default_tenant_slug(as_user=as_user and using_cloud_api)
  File "/usr/local/lib/python3.8/site-packages/prefect/client/client.py", line 928, in get_default_tenant_slug
    res = self.graphql(query)
  File "/usr/local/lib/python3.8/site-packages/prefect/client/client.py", line 297, in graphql
    result = <http://self.post|self.post>(
  File "/usr/local/lib/python3.8/site-packages/prefect/client/client.py", line 212, in post
    response = self._request(
  File "/usr/local/lib/python3.8/site-packages/prefect/client/client.py", line 444, in _request
    response = self._send_request(
  File "/usr/local/lib/python3.8/site-packages/prefect/client/client.py", line 373, in _send_request
    raise ClientError(f"{exc}\n{graphql_msg}") from exc
prefect.utilities.exceptions.ClientError: 400 Client Error: Bad Request for url: <http://prefect-apollo:4200/graphql>

The following error messages were provided by the GraphQL server:

    GRAPHQL_VALIDATION_FAILED: Cannot query field "user" on type "Query".

The GraphQL query was:

    query {
            user {
                default_membership {
                    tenant {
                        slug
                }
            }
        }
    }

The passed variables were:

    null
There is not way to pass flag
as_user=False
I'm in doubt, how to make it work, and why it works locally?
The code where it is failing
Copy code
flow_run = StartFlowRun(
     flow_name = flow_name,
     project_name = project_name,
     parameters = {
          "play_id": play_id,
          "play_name": custom_name
       },
       run_name = custom_name,
       scheduled_start_time = start_time
       )
flow_run.run(idempotency_key=custom_name)
j
Hi @Vitaly Shulgin what version of Prefect are you running?
as_user=False
is passed in by default as of a month ago it looks like from the commit history
v
0.13.9
j
Okay yeah it looks like this was fixed in
0.14.0
v
ok, I'll try to upgarde to 14