Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Appsmith server is not starting because of MongoDB exception

My Appsmith instance just upgraded to v1.6.4 and it's not booting up anymore. In the logs, I can see the exception below:

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"}

Is there anything I can do to bring up my Appsmith instance?

like image 863
Arpit Avatar asked Oct 25 '25 04:10

Arpit


1 Answers

This is a breaking change that was introduced in v1.6.4 of Appsmith because of Spring library upgrades. A complete fix is described at: https://docs.appsmith.com/troubleshooting-guide/deployment-errors#server-not-booting-because-of-mongocommandexception

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.

like image 183
Arpit Avatar answered Oct 26 '25 20:10

Arpit