I've got prefect server and all its components dep...
# prefect-server
I've got prefect server and all its components deployed and talking to each other, now trying to interact w/ it from the cli and running into 400 errors trying to do the first few steps (create tenant)
Copy code
$ prefect agent start --name "Default Agent"
{"errors":[{"message":"Cannot query field \"tenant\" on type \"Query\".","locations":[{"line":2,"column":5}],"extensions":{"code":"GRAPHQL_VALIDATION_FAILED"}}]}

Traceback (most recent call last):
  File "/Users/mattforbes/virtualenvs/py3/bin/prefect", line 8, in <module>
  File "/Users/mattforbes/virtualenvs/py3/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/Users/mattforbes/virtualenvs/py3/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Users/mattforbes/virtualenvs/py3/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/mattforbes/virtualenvs/py3/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/mattforbes/virtualenvs/py3/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/mattforbes/virtualenvs/py3/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Users/mattforbes/virtualenvs/py3/lib/python3.7/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/mattforbes/virtualenvs/py3/lib/python3.7/site-packages/prefect/cli/agent.py", line 263, in start
  File "/Users/mattforbes/virtualenvs/py3/lib/python3.7/site-packages/prefect/agent/local/agent.py", line 78, in __init__
  File "/Users/mattforbes/virtualenvs/py3/lib/python3.7/site-packages/prefect/agent/agent.py", line 153, in __init__
    self.client = Client(api_server=config.cloud.api, api_token=token)
  File "/Users/mattforbes/virtualenvs/py3/lib/python3.7/site-packages/prefect/client/client.py", line 125, in __init__
    tenant_info = self.graphql({"query": {"tenant": {"id"}}})
  File "/Users/mattforbes/virtualenvs/py3/lib/python3.7/site-packages/prefect/client/client.py", line 284, in graphql
  File "/Users/mattforbes/virtualenvs/py3/lib/python3.7/site-packages/prefect/client/client.py", line 238, in post
  File "/Users/mattforbes/virtualenvs/py3/lib/python3.7/site-packages/prefect/client/client.py", line 406, in _request
    session=session, method=method, url=url, params=params, headers=headers
  File "/Users/mattforbes/virtualenvs/py3/lib/python3.7/site-packages/prefect/client/client.py", line 338, in _send_request
  File "/Users/mattforbes/virtualenvs/py3/lib/python3.7/site-packages/requests/models.py", line 941, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url:
added some print statements in the cli script to get the response body
Copy code
  "errors": [
      "message": "Cannot query field \"tenant\" on type \"Query\".",
      "locations": [
          "line": 2,
          "column": 5
      "extensions": {
any advice on how to debug this?
do I have some version incompatibility?
anything change w.r.t tenants in recent releases?
Copy code
$ prefect version
deployed w/
tags from the docker images
Hi @matt forbes - have you run
prefect backend server
before running the agent? If so, can you confirm that:
Copy code
endpoint = "<https://your_deployment_adddress:4200/graphql>"
is set correctly in your
yeah it's correct
however the code uses the config in
but it's set correctly there as well
if I go to that url, I get the graphql playground ui
is there a request I can try running to see if everything is working?
Ok good, that's usually the best place to start. So that specific error message is usually a result of Hasura being unable to run the database migrations correctly - this is usually because either the database didn't start correctly OR the database that exists is incompatible (perhaps a db from a pre-013.0 version of prefect server)
In the playground, can you view the schema? Does
exist there?
that would show up as
type tenant
? no
I may have extracted one of the env variables incorrectly,
is that used to create the schema?
maybe that should be
prefect-server database upgrade -y
Yes - the first time you start the server you'll need to run the migrations, even if you're persisting the db somewhere.
So the command you listed should work
ok I think I'm on the right path, thanks nicholas
great! Let me know if you run into any other issues
👍 I got this all working now, thanks
🚀 1