Cannot convert object to FetchResult error

Posting here and answering myself so that it may help others… this is the situation I ran into:

On a type that I’m creating/developing - I have been experimenting with different data types (e.g. string vs double vs anyof(string,double) ) and MyType.fetch() just stopped working. It was working before on this exact type - only the definition has changed.

I’ve even tried c3ImportAll() to refresh the client side type definitions.

This is the actual error I get:

message: "Cannot convert object to FetchResult for fetch return value: FetchResult.objs[0]: Extraneous property ... on object type ...

What’s going on?

I’m finding that changes to a type definition sometimes are similar enough but not different enough to cause client side metadata to be updated properly. Root cause still to be identified.

However, an easy fix for this is to do a full page refresh - and then c3ImportAll (if still required).

This made the fetch() function work again against the latest type definition I have provisioned.

@paulyip It would be great if you could create a reproducible case in a branch and file a ticket. There isn’t much info to go on in what you’ve posted here.

This is most likely an issue because of anyof() and the JS type system might not be able to parse the fetch result.
Could you try using JS.exec(`<the fetch you want>`) and see if you can see the result.

This solution worked for me.