Hey everyone, I'm getting a weird error when tryi...
# ask-community
b
Hey everyone, I'm getting a weird error when trying to run flows with the docker agent against the cloud backend. The error message asks me to make sure I'm authenticated. However, when I run
prefect auth list-tenants
I get my tenants, so if feel like I should be authenticated. I'm kind of stumped, maybe someone here has an idea?
Copy code
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/prefect/client/client.py", line 738, in _request
    json_resp = response.json()
  File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 900, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/prefect", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/prefect/cli/execute.py", line 53, in flow_run
    result = client.graphql(query)
  File "/usr/local/lib/python3.7/site-packages/prefect/client/client.py", line 550, in graphql
    retry_on_api_error=retry_on_api_error,
  File "/usr/local/lib/python3.7/site-packages/prefect/client/client.py", line 454, in post
    retry_on_api_error=retry_on_api_error,
  File "/usr/local/lib/python3.7/site-packages/prefect/client/client.py", line 744, in _request
    ) from exc
prefect.exceptions.AuthorizationError: Malformed response received from Cloud - please ensure that you are authenticated. See `prefect auth login --help`.
z
Not sure where you're at here, but you should be able to run an agent locally without providing a key if you are logged in.
If you run
prefect auth status
from the same terminal that you're starting the agent from and it indicates that you are logged in,
--key
should be uneccessary.
b
Hmm that's weird.
prefect auth status
says that
You are logged in with an API token. These have been deprecated in favor of API keys.
. However, adding the --key did help..
z
Ah yep so API keys are automatically loaded by agents but tokens are not.
So this is entirely expected
If you do
prefect auth login
with your API key then your agent will work without an additional flag
b
Ah that's good to know. Thank you 🙂