commercetools / commercetools-dotnet-core-sdk

The e-commerce SDK from commercetools running on the .NET Core platform
https://docs.commercetools.com/sdk/dotnet-sdk#net-core-sdk
Apache License 2.0
10 stars 5 forks source link

Serialization of Message using ISerializerService removes Time part from DateTime timestamps #202

Closed PepijnK closed 3 years ago

PepijnK commented 3 years ago

Describe the bug We have a very peculiar situation that somehow only appeared in production and only after 3-4 hours after deployment. The problem is that when re-encoding the CommerceTools Message using an injected commercetools.Sdk.Serialization.ISerializerService into JSON, the time part of timestamps gets removed. This counts for all kind of resources (we mainly handle customers and orders). For example: "createdAt": "2021-09-09T09:50:25.432Z" becomes "createdAt": "2021-09-09" We run the CommerceTools integration application inside a Kubernetes Pod. Maybe the bug gets triggered by some time adjustment/synchronization.

To Reproduce Create and run a service that serializes the Message typed notification inside a k8s pod and wait.

Expected behavior I would expect that timestamps are serialized as timestamps including the time-element.

Screenshots/Code snippet

// This is how we use the serializer
var messageJson = ctSerializerService.Serialize(commerceToolsMessage)

Stack information (please complete the following information):