<#3748 [BUG] Optional type transform not working i...
# flyte-github
a
#3748 [BUG] Optional type transform not working in dynamic workflow Issue created by jganbat-fn Describe the bug Optional type transformation on output is not working during dynamic workflow compilation. Following example workflow:
Copy code
from __future__ import absolute_import, division, print_function
from typing import Optional

from flytekit import task, workflow, dynamic
from flytekit.types.file import FlyteFile

@task
def hello(myfile: Optional[FlyteFile]) -> Optional[FlyteFile]:
    return None

@dynamic
def dyn_hello(myfile: Optional[FlyteFile]) -> Optional[FlyteFile]:
    return hello(myfile=myfile)


@workflow
def child_workflow(myfile: Optional[FlyteFile]) -> Optional[FlyteFile]:
    hello_output = dyn_hello(myfile=myfile)
    return hello_output
when executed showing the following issue in FlytePropeller
Copy code
E0601 21:21:14.327422       1 workers.go:102] error syncing 'flyte-sandbox/anwfrlcbl62scwxzsnh7': 0: [User] malformed dynamic workflow, caused by: Collected Errors: 2
	Error 0: Code: MismatchingTypes, Node Id: end-node, Description: Variable [o1] (type [union_type:<variants:<blob:<> structure:<tag:"FlyteFilePath" > > variants:<simple:NONE structure:<tag:"none" > > > ]) doesn't match expected type [union_type:<variants:<blob:<> > variants:<simple:NONE > > ].
	Error 1: Code: ParameterNotBound, Node Id: end-node, Description: Parameter not bound [o1].
Flytekit version:
v1.4
Flytepropeller version:
v1.1.91
Expected behavior Optional output type is correctly transformed and routed to downstream tasks or returned. relevant slack conversation is here https://flyte-org.slack.com/archives/CP2HDHKE1/p1685654534312309 Additional context to reproduce Register and run the example workflow described above in sandbox. Screenshots No response Are you sure this issue hasn't been raised already? ☑︎ Yes Have you read the Code of Conduct? ☑︎ Yes flyteorg/flyte