Unable to connect to database: ReplicaSetNoPrimary Error


I received the above error after trying to connect to my mongo cluster via nodejs.

Here is my uri string with credentials omitted:
mongodb://username:password@shard.mongodb.net:27017,shard.mongodb.net:27017,shard.mongodb.net:27017/admin?ssl=true&replicaSet=atlas-shard0&readPreference=primary&connectTimeoutMS=10000&authSource=admin&authMechanism=SCRAM-SHA-1

I also tested this when whitelisting all IP addresses and still getting the error. What am i doing wrong here?