Ash FrameworkAF
Ash Framework2mo ago
11 replies
Cooky

AshTypescript: Get with Relationships gives unknown_field error

The example on the Get with Relationships docs does not work for me. It returns the following error:

{
    "errors": [
        {
            "details": {
                "hint": "This error is most likely happening because the generated typescript file used is not up to date with the running backend. 
Check that you are using the latest generated file, and/or that a new file has been generated after the last backend changes.",
                "suggestion": "Check the field name spelling and ensure it's a public attribute, calculation, or relationship"
            },
            "fields": [
                "profile"
            ],
            "message": "Unknown field %{field} for resource %{resource}",
            "path": [],
            "shortMessage": "Unknown field",
            "type": "unknown_field",
            "vars": {
                "field": "profile",
                "resource": "MyApp.Person"
            }
        }
    ],
    "success": false
}


Both resources have the AshTypescript.Resource extension and are included within the typescript_rpc block of the domain.

BTW, if the relationship name is e.g. "the_profile", and called in TypeScript like:

{ fields: ["id", {the_profile: ["name"]}], input: {} }


then the returned error would become "fields": ["theProfile"] (camel case).
Solution
Is the relationship public?
Was this page helpful?