Not able to connect MongoDB

Hello,

i am able to connect MongoDB Atlas collection in my local, but when we deploy build it throws error.

No server chosen by com.mongodb.client.internal.MongoClientDelegate$1@49c15262 from cluster description ClusterDescription{type=REPLICA_SET, connectionMode=MULTIPLE, serverDescriptions=[ServerDescription{address:27017=ac-bqgfptl-shard-00-01.pwrmgvm.mongodb.net, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketReadException: Prematurely reached end of stream}}, ServerDescription{address:27017=ac-bqgfptl-shard-00-00.pwrmgvm.mongodb.net, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketReadException: Prematurely reached end of stream}}, ServerDescription{address:27017=ac-bqgfptl-shard-00-02.pwrmgvm.mongodb.net, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketReadException: Prematurely reached end of stream}}]}. Waiting for 30000 ms before timing out.

We are also facing the same issue in our pre prod servers. One thing we found was that if you have expired cert we will get the prematurely reached end of stream error.

But in case of expired cert we are not seeing the No server chosen line of logging