aws-secrets-manager-rotation-lambdas icon indicating copy to clipboard operation
aws-secrets-manager-rotation-lambdas copied to clipboard

Feature Request: Support MongoDB version 4.0

Open dmskdlghs213 opened this issue 3 years ago • 3 comments

Hi,

According to the official document, MongoDB supports 3.2 or 3.4 for both Single User and Master User. I would like to use MongoDB 4.0 to build DocumentDB, So, it would be nice if the lambda to be rotated could also support version 4.0.

dmskdlghs213 avatar Mar 23 '21 13:03 dmskdlghs213

Thank you for your feedback. We have noted this as a feature request.

whygoyal avatar Mar 02 '22 20:03 whygoyal

Is there any estimated time for this? It's been a while.

julian-alarcon avatar Jul 14 '22 20:07 julian-alarcon

I just tested the current script for the Single rotation scenario and it works for DocumentDB with MongoDB 4.0 compatibility (docdb 4.0.0)!

I am using pymongo version 3.12.3 (BTW, after a lot of testing, the pymongo version used when set the rotation using the AWS Web Console by the current AWS is 3.2), but there is an error with pymongo 4+, this is what AWS Lambda shows using that newer version:

[ERROR] TypeError: 'Collection' object is not callable. If you meant to call the 'authenticate' method on a 'Database' object it is failing because no such method exists.
Traceback (most recent call last):
  File "/var/task/lambda_function.py", line 77, in lambda_handler
    set_secret(service_client, arn, token)
  File "/var/task/lambda_function.py", line 158, in set_secret
    conn = get_connection(pending_dict)
  File "/var/task/lambda_function.py", line 304, in get_connection
    conn = connect_and_authenticate(secret_dict, port, dbname, use_ssl)
  File "/var/task/lambda_function.py", line 377, in connect_and_authenticate
    db.authenticate(secret_dict['username'], secret_dict['password'])
  File "/var/task/pymongo/collection.py", line 3164, in __call__
    "exists." % self.__name

image

From this, maybe we should change the title or open a new ticket asking for the support of pymongo 4+

julian-alarcon avatar Jul 15 '22 18:07 julian-alarcon

Closing this issue since DocumentDB with MongoDB 4.0 compatibility works with the 3.x recommended version of pymongo. If you have a need for pymongo 4, please open a separate issue indicating the need for this newer library.

jbct avatar Jul 10 '23 18:07 jbct