Greetings Jay,

Put simply: Apache Thrift can only send/receive IDL based objects, so you
should never pass parameters or return results that are not defined in IDL.

IDL objects have read() and write() methods that self serialize, the JSON
protocol tries to call these methods on any objects it needs to transmit.
If these methods do not exist the error you received is produced.

Solution: define the type you want to send/receive in IDL and then use that
type.

-Randy

On Thu, Jul 14, 2016 at 8:33 AM, Jayku <[email protected]> wrote:

> Hey Guys,
>
> I encountered a strange problem using JSONProtocol, where I get
> "someObject.
> *write* is not a function" error when I send a JSON payload using Thrift JS
> client library.
> Thrift CPP server excepts a Struct whose fields are optional.
>
> I somehow got reference to this post
>
> http://stackoverflow.com/questions/21416438/convert-json-to-thrift-object-in-nodejs
> which
> is the same problem I deal with. I Couldn't understand what the proposed
> solution in this stack overflow post.
>
> Can someone please help me out?
>
> Thanks,
> Jay.
>

Reply via email to