I got it working by first creating the content types and then populating the content types with atleast 2 entries each and then I created the relation between them and it worked, it is not showing any errors now and the media library is also working fine.
I got it fixed but I hope the Strapi Dev Team can take a note of this and fix this minor issue in the upcoming versions.
Hope it helps fellow devs and creators alike.
Regards