It would be helpful if the connect function would support getting one of "@aws-sdk/credential-providers", in case of AWS authentication.
see:
https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/modules/_aws_sdk_credential_providers.html#fromNodeProviderChain
Reason:
mongo db driver for node js, checks the credentials in specific order, and gives precedence to env. There is no way to override it.
This causes a problem when running from EKS cluster, and using web identity token file.
When my pod needs to access also other AWS resources like S3, and I expose AWS environment variables (like AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY), the MongoDB driver takes into account the credentials before the web identity token, and fails to connect as my pod specific user, can’t access Atlas.
When I don’t expose AWS variables, my pod successfully uses the web identity token and connects to Atals.
). We need a way to tell the driver where to take the credentials from, not relying on default precedence order.