Managed Mongo - Host: *********-mongodb. is not in the cert's altnames:

I am attempting to connect to a Managed Mongo (DocDB) instance using a mongoose connector.

  • rds-combined-bundle is installed.
  • connection is configured using ssl
  • the same code is running in production using a non-qovery instance of document DB.
        const srvUrl = `mongodb://${user}:${password}@${url}/databasename?retryWrites=true&w=majority`;
        const conn = await mongoose.createConnection(srvUrl, {
          useNewUrlParser: true,
          useFindAndModify: false,
          useCreateIndex: true,
          ssl: true,
          sslCA: pemFile,
        });

The problem is HOST_INTERNAL is *******-mongodb, document db is expecting a path like… *******-mongodb.cluster-***********.region.docdb.amazonaws.com

It does not appear that this cluster identifying information exists in any environment variable. The cluster identifier appears to be consistent across my aws region so I can probably work around the problem. But it seems to me like we would need access to the full path to make a connection.

Maybe I am missing something?

For anyone who comes across this I was able to get a connection working by adding a second environment variable with the DocDB cluster identifier like: .cluster-**********.region.docdb.amazonaws.com:27017, append it to the HOST_INTERNAL and got a connection running.

Hi @Corky3892 ,

Thank you for providing the solution to your issue. BTW, I want to highlight that Qovery provides you with a built-in way to do Environment Variables interpolation. So you don’t need to do it in your application :slight_smile:

So I followed the linked guide to create an interpolated environment variable as this would indeed be better then modifying the application.

After creating the interpolated variable, I attempted to clone the environment, now I receive the following response 400 response attempting to clone the environment.

You can't select a port with this probe type.

I removed the interpolated variable and attempted the operation again and still receiving the same error. It’s not clear to me if this new error has any correlation to the interpolated env variable or not.