How should I go about fixing the error "Ensure condition failed: MyOwnerWorld" when cooking my project?

I was getting a similar error, because I was calling SetReplicated(true) on an ActorComponent in a constructor. Moved it to BeginPlay and now it compiles when cooking and shipping the solution.