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.

Database connect for other users on self-hosted instances

Issue

I hosted appsmith on my local server and connected it to an external MongoDB. When my friend also uses the same MongoDB URI and tries to access an app with a datasource connected, they receive an "internal server error" message. This does not happen in simple apps without datasources. Although we are using an external MongoDB to store application data, the issue persists. To resolve this, I need to ensure that all instances connecting to the same MongoDB have the same values for APPSMITH_ENCRYPTION_PASSWORD and APPSMITH_ENCRYPTION_SALT.

Resolution

The issue reported is that while using Appsmith with an external MongoDB datastore, multiple instances of Appsmith can be connected to the same MongoDB, however, while trying to access an app with a datasource connected, an "internal server error" is encountered. This error does not occur when accessing apps without a datasource connected.

The solution to this issue is to ensure that all instances of Appsmith that are connecting to the same MongoDB have the same values for the APPSMITH_ENCRYPTION_PASSWORD and APPSMITH_ENCRYPTION_SALT environment variables.

When a datasource is created on Appsmith to connect to a database, sensitive details like passwords are stored encrypted in MongoDB. This encryption is performed using salt and password values, which must remain consistent across all instances of Appsmith that are connecting to the same MongoDB.

To resolve the issue, the values for APPSMITH_ENCRYPTION_PASSWORD and APPSMITH_ENCRYPTION_SALT must be the same across all instances of Appsmith. This can be achieved by setting the environment variables to the same values in all instances of Appsmith.