Category: Data Source
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

Adding mongodb as connection always shows Exception authenticating MongoCredential

Issue

I am trying to connect Appsmith to a MongoDB instance deployed via docker in my local machine, using the same credentials that work in Compass. However, I am unable to connect and I am getting an error. I have exported the MongoDB port to 27017 and created a user with password and auth type SCRAM-SHA-256. Can someone help me troubleshoot the issue?

Resolution

Based on the information provided, it seems that the issue may be with the way the datasource is configured in Appsmith. Here are a few steps that can help resolve the issue:



  1. Make sure that the hostname/IP address and port number specified in the datasource configuration in Appsmith match the ones used to deploy MongoDB via Docker.



  2. Ensure that the username and password specified in the datasource configuration match the ones you created while setting up the MongoDB instance.



  3. Verify that the auth type specified in the datasource configuration is indeed SCRAM-SHA-256. If not, update it accordingly.



  4. If the above steps don't resolve the issue, try adding the following parameters to the MongoDB connection string in the database URL field in the datasource configuration (separated by '&' symbol):



tls=false&ssl=false

This setting disables TLS/SSL encryption, which may be causing issues with the connection.

Here's an example connection string for connecting to MongoDB via Appsmith:

mongodb://[username]:[password]@[hostname]:[port]/[database]?tls=false&ssl=false

Replace the placeholders with the actual values specific to your setup.

If the issue still persists, share the screenshots of the error message and the datasource configuration in Appsmith for further assistance.