M10 and AWS Lambda connection issue

Hello, Is there any news?
I’m having the same issue with my lambda

    "error": "failed to ping MongoDB: server selection error: context deadline exceeded, current topology: { Type: ReplicaSetNoPrimary, Servers: [{ Addr: live-shard-00-00.ryh7x.mongodb.net:27017, Type: Unknown }, { Addr: live-shard-00-01.ryh7x.mongodb.net:27017, Type: Unknown }, { Addr: live-shard-00-02.ryh7x.mongodb.net:27017, Type: Unknown }, ] }",
    "level": "error",
    "msg": "failed to connect to database",
    "time": "2023-06-20T13:54:38Z"

Some details about my lambda
go 1.19
go.mongodb.org/mongo-driver v1.11.4

and my DB
Version: 5.0.18
Region: AWS Ireland (eu-west-1)
Cluster tier: M10 (General)

I have two stage test and prod. The test stage is working correctly, but the prod stage is throwing an error, even though both stages have the same configuration. I also added the IP of my VPC into IP Access List for two stages.

Hi @Thuc_NGUYEN1,

I’ve moved this to a new topic because it is difficult to confirm whether this is exactly the same issue as the original post. For example, the error you’ve included slightly differs to the original post.

Are both environments connecting to the same cluster? Can you also advise how often this is happening?


@Jason_Tran I figured out the problem. It’s my fault, I forgot an outbound rule in the security group of my VPC, I added and it works like a charm.

Thanks anyway


1 Like

Awesome. Glad to hear you got it solved and thanks for updating the post with those details.


This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.