Hello! I just upgraded to prefect 0.15 and started...
# ask-community
m
Hello! I just upgraded to prefect 0.15 and started trying to use the kv store. My flow is giving this error:
field "key_value" not found in type: "query_root"
. But my query works in the interactive API console. (I'm using cloud prefect) Have folks seen this error before?
Full error:
Copy code
prefect.exceptions.ClientError: [{'path': ['key_value'], 'message': 'field "key_value" not found in type: \'query_root\'', 'extensions': {'path': '$.selectionSet.key_value', 'code': 'validation-failed', 'exception': {'message': 'field "key_value" not found in type: \'query_root\''}}}]
Query that works in cloud, but fails in flow:
Copy code
query {
  key_value (where: {key: {_eq: "foo-bar-key"}}) {
    value
  }
}
k
Hi @Michael Terry, could you show me how you use it in the Flow?
m
That error is coming from a call to
prefect.backend.get_key_value(key='foo-bar-key')
and erroring out when making the graphql call under the covers
k
Looks good to me. Let me raise this to the team
Seems like you may be using an old api token that doesn’t have kv permissions. Could you generate a new token and try again?
m
Ah.... OK I can try that. Thanks for the response!
Hmm, my data engineer says they did generate a new api token with
prefect auth login --key xxx
- they believe the flow is running with a fresh key
But you're saying that's what that error means - an old key?
k
That’s the most likely scenario yep. Could you try
prefect kv get foo-bar-key
in the CLI? I assume this would error out in the same way. Just confirming you’re on Cloud also?
m
Yeah cloud
k
Is it possible your key has restricted permissions?
m
Working on answers 🙂 But thank you for your help
OK, it's possible an old key snuck in - we're investigating, but that's the going theory. Thank you for your help, and I'll comment here if that does eventually fix it
👍 1
OK yup that was it, an old key still being used. Thank you!
👍 1
k
Thanks for circling back!
e
@Mark Stella Here is our issue
@Kevin Kho We are facing the same issue. Tried with new service account(admin) and issue still persists. prefect V0.15.3. It works fine on CLI
k
You are using the KV store right?
e
Yes - trying to use KV store
k
When you say it works fine on the CLI,
prefect kv get
and
prefect kv set
work but using it in the script does not?
e
Correct.
get_key_value(key=key)
&
set_key_value(key=key, value=val)
is giving the error
field "key_value" not found in type: "query_root"
k
Did you do
prefect auth login --key ….
with the new service account key?
Ah well, I guess you did if the CLI works. Let me think, but it seems like your script is not using the same key somehow.
Can you show me the output of
prefect diagnostics
?
Is there a chance your Python script is not running on 0.15.3? Different environment?
e
we are using a gitlab runner to deploy the flow. can it be the prefect agents - our agents are on v0.14.2
Will try upgrading agents first
k
Ah that would do it. Your agents need the key also.
e
Thanks -would also update that to new service accounts
KV Issues resolved after upgrading our agent to v0.15.3 (agent is also using the new service account). Thanks @Kevin Kho for your support
k
Nice!