Ajith Kumara Beragala Acharige Lal
01/23/2021, 2:23 AMException raised while calling state handlers: ClientError('400 Client Error: Bad Request for url: <http://10.110.0.7:8081/graphql>\n\nThe following error messages were provided by the GraphQL server:\n\n GRAPHQL_VALIDATION_FAILED: Cannot query field "secret_value" on type "Query".\n\nThe GraphQL query was:\n\n query($name: String!) {\n secret_value(name: $name)\n }\n\nThe passed variables were:\n\n {"name": "EMAIL_USERNAME"}\n',)
`Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/prefect/client/secrets.py", line 137, in get
value = secrets[self.name]
KeyError: 'EMAIL_USERNAME'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/prefect/client/client.py", line 361, in _send_request
response.raise_for_status()
File "/usr/local/lib/python3.6/dist-packages/requests/models.py", line 943, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: <http://10.110.0.7:8081/graphql>
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/prefect/engine/cloud/flow_runner.py", line 120, in call_runner_target_handlers
old_state=old_state, new_state=new_state
File "/usr/local/lib/python3.6/dist-packages/prefect/engine/flow_runner.py", line 116, in call_runner_target_handlers
new_state = handler(self.flow, old_state, new_state) or new_state
File "punctualityDailySummariesPrefectShell.py", line 40, in email_on_failure
File "/usr/local/lib/python3.6/dist-packages/prefect/utilities/tasks.py", line 450, in method
return run_method(self, *args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/prefect/tasks/notifications/email_task.py", line 98, in run
username = cast(str, Secret("EMAIL_USERNAME").get())
File "/usr/local/lib/python3.6/dist-packages/prefect/client/secrets.py", line 157, in get
raise exc
File "/usr/local/lib/python3.6/dist-packages/prefect/client/secrets.py", line 147, in get
variables=dict(name=self.name),
File "/usr/local/lib/python3.6/dist-packages/prefect/client/client.py", line 304, in graphql
retry_on_api_error=retry_on_api_error,
File "/usr/local/lib/python3.6/dist-packages/prefect/client/client.py", line 220, in post
retry_on_api_error=retry_on_api_error,
File "/usr/local/lib/python3.6/dist-packages/prefect/client/client.py", line 446, in _request
session=session, method=method, url=url, params=params, headers=headers
File "/usr/local/lib/python3.6/dist-packages/prefect/client/client.py", line 374, in _send_request
raise ClientError(f"{exc}\n{graphql_msg}") from exc
prefect.utilities.exceptions.ClientError: 400 Client Error: Bad Request for url: <http://10.110.0.7:8081/graphql>
The following error messages were provided by the GraphQL server:
GRAPHQL_VALIDATION_FAILED: Cannot query field "secret_value" on type "Query".
The GraphQL query was:
query($name: String!) {
secret_value(name: $name)
}
The passed variables were:
{"name": "EMAIL_USERNAME"}`
with Flow("flow_punctualityDailySummaries",state_handlers=[email_on_failure]) as f:
context.secrets["PREFECT__CONTEXT__SECRETS__EMAIL_USERNAME"] = "ab@xxxx"
context.secrets["PREFECT__CONTEXT__SECRETS__EMAIL_PASSWORD"] = "xxxxxxxx"
context.secrets["PREFECT__CONTEXT__SECRETS__EMAIL_HOST"] = "<http://smtp.gmail.com|smtp.gmail.com>"
context.secrets["PREFECT__CONTEXT__SECRETS__EMAIL_PORT"] = "587"
context.secrets["PREFECT__CONTEXT__SECRETS__EMAIL_FAIL_SILENT"] = "False"
context.secrets["EMAIL_USERNAME"] = "ab@xxxx"
context.secrets["EMAIL_PASSWORD"] = "xxxxxxxx"
context.secrets["EMAIL_HOST"] = "<http://smtp.gmail.com|smtp.gmail.com>"
context.secrets["EMAIL_PORT"] = "587"
context.secrets["EMAIL_FAIL_SILENT"] = "False"
SERVER
mode ( local test works but SERVER execution failsChris White
PREFECT__CONTEXT__SECRETS__EMAIL_USERNAME
as an environment variable on your flow run. The easiest way to do this is via the -e
CLI flag on your agent - this will ensure that the context value is set appropriately for each run that your agent submitsAjith Kumara Beragala Acharige Lal
01/23/2021, 3:25 AMChris White
Ajith Kumara Beragala Acharige Lal
01/23/2021, 3:34 AMChris White