Properties not serialized by Javascript/Typescript Client

Hi guys,

For some reason I am suddenly struggling with serialization errors on my messages/DTOs (I’m tackling this the same way that I always do - so I’m a little lost as to what the cause could be). Hopefully its something small, as it seems to be a persistent problem across all my messages with payloads (based on JavaScript that was working previously).

your assistance would be greatly appreciated, as this is currently hamstringing my development efforts :frowning:

here are the details :

I am using version 0.0.38 of the servicestack-client package in an application based on the Vue.js App template.

here is an example of one of my messages :

this is what the model/dto behind the RecordType property looks like :

this is what the generated DTOS look like in my web project :


the code that executes the request looks like this :

at runtime the method is executed like this (drilled down to the “fetch” executed by the servicestack client in index.ts) :

when I look at the object transported over the wire using Fiddler, however - I don’t see a payload :

this (obviously) results in a NULL RecordType property within the Service.

things I’ve tried :

  1. adding DataContract/DataMember attributes to the message / dto
  2. changing the casing of the properties on the message / DTO
  3. using a POST instead of a PUT
  4. Updating the servicestack client version (was originally 0.0.35)

What am I missing?

[RB]

That’s the browser making an OPTIONS pre-flight CORS request, is your origin and destination server the same? or do you have CORS enabled?

CORS is enabled - server and client are on different hosts. I originally had the CORS enabled using the Plugin, but struggled with errors related to the Access-Control-Allow-Origin/Access-Control-Allow-Credentials values (which persisted even when setting the properties when adding the Plugin).

I am currently setting these manually as follows :

PS: I didn’t think it would be CORS-related because other POST requests (without a payload) are eliciting a 200 Response :

removing the code above and adding with the following resolved the issue - thanks for pointing me in the right direction, Demis :

1 Like