I’ve been doing some research on this and I’m also able to duplicate the problem. I have a skeleton Rails app working which connects to MongoDB Atlas but when I deploy it to us I see an authentication error:
W, [2021-07-27T15:33:32.067071 #144] WARN -- : MONGODB | Failed to authenticate to cluster0-shard-00-02.s0icl.mongodb.net:27017: Mongo::Auth::Unauthorized: User dbuser (mechanism: scram) is not authorized to access myFirstDatabase (auth source: myFirstDatabase, used mechanism: SCRAM-SHA-1, used server: cluster0-shard-00-02.s0icl.mongodb.net:27017 (PRIMARY)): [8000:AtlasError]: bad auth : Authentication failed.
I’ve tried with a different user/password but no success so I’m in touch with MongoDB to figure out what’s going on here.