toptal / haste-server

open source pastebin written in node.js
https://www.toptal.com/developers/hastebin/about
2.92k stars 796 forks source link

Authentication failed (MongoDB) #440

Closed stathri closed 1 year ago

stathri commented 1 year ago

Hi, I'm having issues using MongoDB as storage. It worked up until I changed the username & database name. I did update both of those in the configuration file however it refuses to authenticate.

See the storage config below. I've removed the password and IP address for obvious reasons.

image

See the error below.

image
filipechagas commented 1 year ago

Hi @stathri I'm sorry you're having issues connecting with mongo.

I can't say for sure, but it seems your connection string is malformed. According the documentation the expected format is:

mongodb://[username:password@]host1[:port1][,...hostN[:portN]][/[defaultauthdb][?options]]
stathri commented 1 year ago

Hi, adding ?authSource=admin seems to have fixed it.