In release v1.6.4, we upgraded our libraries & Spring framework. This caused a compatibility issue between the libraries used within Appsmith and the version of MongoDB that was shipped earlier. This didn't show up in our testing because all our testing happened against MongoDB clusters with replica sets, where the problem doesn't surface. Apologies for this.

If you see an error like below, your instance is affected by this library upgrade & you should follow the steps mentioned to fix it.

Caused by: com.mongodb.MongoCommandException: Command failed with error 17 (ProtocolError): 'Attempt to switch database target during SASL authentication.' on server mongo:27017. The full response is {"ok": 0.0, "errmsg": "Attempt to switch database target during SASL authentication.", "code": 17, "codeName": "ProtocolError"}

Here are the steps to fix this problem for your instance.

Step 1: Edit MongoDB URI

Adding &authSource=admin to the end of your APPSMITH_MONGODB_URI variable’s value in your docker.env file. For example, in your docker.env file, if you have the following line:

# Old config
APPSMITH_MONGODB_URI=mongodb://<your_username>:<your_password>@mongo/appsmith?retryWrites=true

Change it to the following (notice the only change is &authSource=admin. Do NOT copy-paste this whole line. Only add the &authSource=admin part to your existing value.

# New config
APPSMITH_MONGODB_URI=mongodb://<your_username>:<your_password>@mongo/appsmith?retryWrites=true&authSource=admin

Save the file.

Step 2: Restart server

Now restart your container with the following command:

sudo docker-compose up -d --force-recreate appsmith-internal-server

In a minute or two, the server should now come up and be ready.