Connection from K8S pod by mongosh to MongoDB Atlas

Hello. I have a DB in mongodb Atlas, a k8s cluster in AWS, pod with installed mongosh 2.3.0 and assumed role, that has permissions for read/write to mongodb Atlas.
I need this functionality to automate some process with “dev” environment. In general I want to delete all data in one DB.

I want to use assumed role for authentication in mongodb Atlas.

When I try to connect and make backup from a pod with a mongodump - all is fine, when I try to connect to the same db from the same pod and run a command - I get an error:

MongoAWSError: Missing internal module './722.mongosh.js'

Command for backup:
mongodump --uri=“mongodb+srv://my_cluster_replica_set.mongodb.net/db_name?authSource=%24external&authMechanism=MONGODB-AWS” --archive=db_name.gz --gzip

Command for connect:
mongosh “mongodb+srv://my_cluster_replica_set.mongodb.net/?authSource=%24external&authMechanism=MONGODB-AWS” --eval “db.adminCommand({listDatabases: 1})”

Looks like there is some problem with authentication, but mongodump works fine.

Any ideas?

P.S. Base image for pod: Ubuntu 20.04 and 22.04
Also I tried another version of mongosh (2.2.15)

I found, that authentication works fine on version 2.1.5, but is broken on 2.2.0

I have the same problem, only mine says
MongoAWSError: Missing internal module ‘./502.mongosh.js’

I have no idea how to install an earlier version of mongosh, it doesn’t seem available

Also facing this error with mongosh 2.4.2 → 2.5.1

Greetings All,
Thank you for bringing this issue to our attention. Could you please try upgrading to the latest version of mongosh 2.5.2 and let us know if the problem persists? Your feedback will help us investigate further and ensure a resolution.

Thank you for your message. I’ve tested the new version and it works fine. Thank you one more time.

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