Issue with mongo replica

Hello everyone,
I have a Mongo setup of three nodes (Primary, Secondary and Arbitrary) both Primary and Secondary have the same priority and when secondary goes down i can keep connect to the RS but when the primary goes down and the secondary becomes primary i can’t connect to the RS as it gives (connect ECONNREFUSED

at that moment a direct connection to the secondary works fine!

I am running the RS locally on docker and my connection string is :