Subterfuge-Revived / Remake-Core

Core repository that holds all game logic for both front end rendering and back end validation.
Creative Commons Zero v1.0 Universal
39 stars 24 forks source link

MongoDB Serialization Issue #108

Closed QuinnBast closed 1 year ago

QuinnBast commented 1 year ago

When running the server in a docker environment, it seems as though the MongoDB documents are unable to serialize the stored data types as proper game events to return from the /events endpoint. This causes the server to throw 500 internal server errors and is actually a very big issue.

I think the issue is that MongoDB is trying to serializa a polymorphic class into a particular data type, but for some reason it can't do that sometimes?

Seems to work fine on an initial run but after the container stops and restarts it seems to lose knowledge about the ploymorphic types somehow? Uncertain honestly.

Possible Solutions

Store the event data as a JSON string and then desrialize it based on the EventDataType field, or figure out the Mongo polymorphic deserialization