Skip to content

MongoDB client connection string not parsed correctly any more #511

@dewet22

Description

@dewet22

Description

Between 0.5.0-beta.12 and 0.5.0-beta.18 (no releases in-between? also no git tags I can find?) it seems the parsing for MongoDB connection strings/database names was broken. This config worked before but resulted in a stack trace after updating the docker image to .18:

      ...
      "ConnectionStrings": {
        "Type": "mongodb",
        "DatabaseName": "InformaticsGateway"
      },
      ...

Injected via env variable is the connection string, in order to load it from kubernetes secrets, although that doesn't seem to make a difference since the same behaviour exhibits when that is put in the json config file as well:

ConnectionStrings__InformaticsGatewayDatabase=mongodb://mig:xxx@mongodb:27017/InformaticsGateway

I've verified that connection string works across MongoDB versions 5, 6 and 7 using mongosh so it isn't an authentication issue.

Relevant stack trace:

│ 2024-02-27 22:47:00.8535|3011|ERROR|Monai.Deploy.InformaticsGateway.Services.Connectors.PayloadAssembler|EventId=3011, EventName=ErrorProcessingBuckets|Error while processing buckets/payloads. System.ArgumentException:  │
│ Database names must be non-empty and not contain '.' or the null character. (Parameter 'databaseName')                                                                                                                      │
│    at MongoDB.Driver.Core.Misc.Ensure.That[T](T value, Func`2 assertion, String paramName, String message)                                                                                                                  │
│    at MongoDB.Driver.DatabaseNamespace..ctor(String databaseName)                                                                                                                                                           │
│    at MongoDB.Driver.MongoClient.GetDatabase(String name, MongoDatabaseSettings settings)                                                                                                                                   │

Configuration

  • Informatics Gateway version/commit: 0.4.1 running stable in production, I was investigating upgrading to latest/0.5.0-beta.90 and worked backwards
  • OS and version (distro if applicable): Amazon Linux on EKS
  • Kubernetes version (if applicable): 1.29
  • Docker version (if applicable): unknown
  • Installation source (NGC, Dockerhub, or something else): custom helm charts pulling from Dockerhub
  • Hardware configuration (CPU, GPU, memory, storage, etc...): n/a

Regression?

Yes, works fine in 0.4.1 until 0.5.0-beta.12, seems broken after that. I've tried to look through commits since 2023-09-22 which was the last known good point but GitHub's UI is just frustrating me.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions