Certificate error while connecting using private endpoint

I’ve created cloud hosted mongodb instance and created secure connection to GCP project using private endpoint When I’m trying to connect to my cluster using mongosh installed on VM hosted in GCP I get this error

MongoServerSelectionError: Hostname/IP does not match certificate's altnames: Host: pl-00-000-us-central1-gcp.XXXXX.mongodb.net. is not in the cert's altnames: DNS:*.2e7aec278601c55e35d6d1ae.YYYYYYY.mongodb.net, DNS:*.YYYYYYY.mesh.mongodb.net, DNS:*.YYYYYYY.mongodb.net

Using public db endpoint works fine. Any ideas how to solve this?