Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-3524

AuthMechanism "MONGODB-AWS" doesn't allow me to set an empty value

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: Lambda
    • Labels:
    • Not Needed

      What problem are you facing?

      I'm currently connecting to MongoDB on the Vercel platform and I can't authenticate using our AWS credentials because Vercel is using AWS Lambdas and AWS_SESSION_TOKEN is present in the environment. These credentials are reserved and we shouldn't touch them or use them.

      This was working in a previous version 3.6.5 with the following connection string:

      const mongodbUrl = `${process.env.MONGODB_URL}?authMechanismProperties=AWS_SESSION_TOKEN:false`
      

      What driver and relevant dependency versions are you using?

      3.6.10

      Steps to reproduce?

      Try authenticate using the authMechanism: "MONGODB-AWS" and populate process.env.AWS_SESSION_TOKEN with an invalid session token and set the connection url with either:

      authMechanismProperties=AWS_SESSION_TOKEN:false
      authMechanismProperties=AWS_SESSION_TOKEN:
      

      The driver won't accept these as real values and will pick AWS_SESSION_TOKEN instead even though an empty string is a valid value yo be given.

      A stricter check would allow these cases.

      (this.mechanismProperties.AWS_SESSION_TOKEN === undefined && process.env.AWS_SESSION_TOKEN)

      Code

       

            Assignee:
            Unassigned Unassigned
            Reporter:
            henrique@vitt.sh Henrique Silva
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: