I am trying to deploy my application to AWS Lightsail. However, I run into this error: MongoError: not authorized on admin to execute command { listIndexes: "users", .....
. The server is running the Bitnami MEAN stack version 3.6.5-0. I have followed this tutorial when creating the server. I have created a database, switched to it, and created the .env file with the connection string of: mongodb://user:pwd@localhost:27017/?authMechanism=SCRAM-SHA-1&authSource=database
.
The application says that it connects to the database and then immediately throws the above error and crashes the entire application. From what I have found it seems like it could be an issue with the role of the database user that I have created for it. The database user has the role of "dbOwner", which according the the tutorial and the MongoDB documentation should be fine.
I've tried a number of different solutions including changing the user roles, changing the connection string, as well as others. None of which have worked for me so far. I would appreciate some help on this as I have been stuck on this for days. Thank you.