acoustic-carpenter-78188
03/30/2023, 8:21 PMdataclass the UI breaks with an unhelpful react error as shown in the screenshot:
The error we received was:
TypeError: can't convert null to object
There may be additional information in the browser console.
Please find this minimal example workflow:
from typing import Optional, Dict
from dataclasses import dataclass
from dataclasses_json import dataclass_json
from flytekit import task, workflow
@dataclass_json
@dataclass
class MyConfig:
k: Optional[Dict] = None
@task
def t1(a: MyConfig) -> str:
if a.k and "foo" in a.k:
return a.k["foo"]
else:
return "42"
@workflow
def my_wf(a: MyConfig = MyConfig()) -> str:
x = t1(a=a)
return x
where k has a wrong default. Instead of k: Optional[Dict] = None, it should be
from dataclasses import field
@dataclass_json
@dataclass
class MyConfig:
k: Optional[Dict] = field(default_factory=lambda: {})
Expected behavior
I am aware of the error on the user side.
Still: I think flyte could show a more helpful error message here to point to the bad parameter.
Additional context to reproduce
The error shown in the browser dev console is:
TypeError: can't convert null to object
**REDACTED**
Object { componentStack: "\n in Unknown\n in div\n in S\n in section\n in ForwardRef\n in div\n in ForwardRef\n in ForwardRef\n in Unknown\n in Unknown\n in div\n in ForwardRef\n in ForwardRef\n in div\n in t\n in ForwardRef\n in s\n in div\n in ForwardRef\n in ForwardRef\n in ForwardRef\n in ForwardRef\n in Unknown\n in E\n in Unknown\n in Unknown\n in Unknown\n in E\n in div\n in Unknown\n in Unknown\n in t\n in t\n in Unknown\n in E\n in t\n in div\n in t\n in Unknown\n in l\n in c\n in l\n in Unknown\n in Unknown\n in Unknown" }
main-965d5331.js:1:369655
Screenshots
image▾
acoustic-carpenter-78188
03/30/2023, 8:21 PM