Hi guys, I hit the error in agent: ```ERROR - age...
# prefect-community
a
Hi guys, I hit the error in agent:
Copy code
ERROR - agent | Error while deploying flow: ValidationError({'_schema': 'Invalid data type: None'})
What I did is creating the workflow with a label and using graphql API to register the flow:
Copy code
alert_flow.environment = LocalEnvironment(labels=['public'])
Copy code
create_flow_mutation = """
            mutation($input: create_flow_input!) {
                create_flow(input: $input) {
                    id
                }
            }
        """
        serialized_flow = flow._flow.serialize(build=False)
        self._client.graphql(query=create_flow_mutation,
                             variables=dict(
                                 input=dict(
                                    serialized_flow=serialized_flow,
                                    set_schedule_active=False
                                    )
                                )
                            )
I do not get more log for debugging, please help, thanks!
c
Hi Alfie, this isn’t enough information for us to debug unfortunately; it appears that your Flow cannot be deserialized. Maybe try:
Copy code
from prefect.serialization.flow import FlowSchema

schema = FlowSchema()
schema.load(serialized_flow)
and see if you can figure out which piece of the Flow is causing your error
a
Thanks @Chris White, I do see these error via schema.load:
Copy code
{   'context': {   'create_object': True,
                   'task_cache': {   'delay-1': <Task: delay>,
                                     'filter_query_results-1': <Task: filter_query_results>,
                                     'load_alert_config-1': <Task: load_alert_config>,
                                     'query_in_greenland-1': <Task: query_in_greenland>,
                                     'trigger_action-1': <Task: trigger_action>}},
    'declared_fields': OrderedDict([   (   'project',
                                           <fields.String(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=True, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>),
                                       (   'name',
                                           <fields.String(default=<marshmallow.missing>, attribute=None, validate=None, required=True, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=True, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>),
                                       (   'version',
                                           <fields.String(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=True, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>),
                                       (   'description',
                                           <fields.String(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=True, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>),
                                       (   'type',
                                           <fields.Function(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>),
                                       (   'schedule',
                                           <fields.Nested(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=True, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'type': 'Invalid type.'})>),
but the wired thing is the flow works by flow.register()
And just get the problem if I use the graphql to create it
But I want to use arg set_schedule_active in register, and hit this error:
Copy code
>       flow.register(set_schedule_active=False)
E       TypeError: register() got an unexpected keyword argument 'set_schedule_active'
d
Did you resolve this? I have received the same error, and are not sure why😞 I know it has something to do with the labels, but that's pretty much it