5 months ago
Hi Railway Support,
After I hit the billing limit my project was suspended. I re‑enabled billing and all services came back online, but the MongoDB instance in project be3f2db8-13c1-4dfb-b758-fbaace10701c has refused connections ever since. The data volume is still there—we can’t afford to lose that data.
What I’ve tried:
Verified TCP proxy is active and internal hostname mongodb.railway.internal:27017 resolves for other services.
Updated MONGO_URL/MONGO_PUBLIC_URL in every service to match the current variables.
Ran mongosh directly against the proxy with the current values (mongodb://mongo:<password>:44620/railway?authSource=admin) and consistently get MongoServerError: Authentication failed.
Confirmed the values in MONGO_INITDB_ROOT_PASSWORD and MONGOPASSWORD match what I’m testing.
It looks like the original root password (from before suspension) is still the one stored in MongoDB, but the environment variables were regenerated when the service came back. Since I no longer have that original password, I’m locked out even though the container is healthy.
Could you please rotate or reset the MongoDB root user password for this service while keeping the existing data volume intact? I’m happy to accept a randomly generated password or set it to a value you provide; I just need working credentials so I can update MONGO_URL and restore access for my application.
Relevant details:
Project ID: be3f2db8-13c1-4dfb-b758-fbaace10701c
Service: “MongoDB” (the one linked to the agile-stillness app)
Current env vars: MONGO_URL, MONGO_PUBLIC_URL, MONGO_INITDB_ROOT_PASSWORD
Reproduction: mongosh "mongodb://mongo:<password>:44620/railway?authSource=admin"
Please let me know when the password has been rotated (or share the existing one if you can extract it). I’ll update our env vars and redeploy immediately afterward.
Thanks in advance for the help!
Pinned Solution
5 months ago
Here's what you're going to do.
Go into the MongoDB service and change the start command to:
mongod --ipv6 --bind_ip ::,0.0.0.0 --noauth --setParameter diagnosticDataCollectionEnabled=false --setParameter enableLocalhostAuthBypass=0
Right click the service and copy the SSH command, paste that into your terminal.
Type the following commands:
mongosh
use admin
db.changeUserPassword("mongo", passwordPrompt())
Change MONGO_INITDB_ROOT_PASSWORD to be this new password.
Exit this window and change your start command back to:
mongod --ipv6 --bind_ip ::,0.0.0.0 --setParameter diagnosticDataCollectionEnabled=false
13 Replies
5 months ago
This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.
Status changed to Open brody • 5 months ago
5 months ago
Hey!
Have you modified the authentication-related variables since redeployment?
samgordon
Hey!Have you modified the authentication-related variables since redeployment?
5 months ago
Hi
i just changed the MONGO_PUBLIC_URL variable and i reverted back but still not working.
5 months ago
Hello,
thank you for the help.
I cant find in the logs the old password is there easier way to find it or search it on the logs?
5 months ago
Hi ,
Thanks for the earlier pointers. I tried every option suggested:
Restored MONGO_PUBLIC_URL and confirmed the TCP proxy is active.
Linked the project via the Railway CLI and attempted to exec into the Mongo service to run mongosh, but mongosh --port 27017 returns ECONNREFUSED. It looks like the exec shell is isolated and doesn’t expose the running mongod, so I can’t reset the password from inside the container.
I also dug through my repo and activity history and couldn’t recover the original password. Every external mongosh attempt still fails with MongoServerError: Authentication failed.
I have clients calling and emailing because they can’t log in, so I’m stuck until the credentials match again.
Can you please rotate the MongoDB root password on the current volume and send me the new value? I’ll immediately update MONGO_URL and redeploy as soon as I receive it. The project is be3f2db8-13c1-4dfb-b758-fbaace10701c (“aware-wisdom”), MongoDB service.
Thanks for helping me get this back online quickly.
5 months ago
Howdy!
Are you able to copy that public mongo URL and connect to it with an external database viewer?
Something like compass.
Want to nail down if this is a mongo password mismatch or some other bug.
noahd
Howdy!Are you able to copy that public mongo URL and connect to it with an external database viewer?Something like compass.Want to nail down if this is a mongo password mismatch or some other bug.
5 months ago
I tried connecting externally with the exact MONGO_URL through mongosh on my machine:
nginx
and it still returns MongoServerError: Authentication failed. So a GUI like Compass would hit the same password mismatch.
Everything points to the data volume still holding the original root password from before the suspension. I can’t recover that value and I can’t reach the running mongod to change it myself, so I’m stuck until the password is rotated on your end.
diinow11
I tried connecting externally with the exact MONGO_URL through mongosh on my machine:nginxand it still returns MongoServerError: Authentication failed. So a GUI like Compass would hit the same password mismatch.Everything points to the data volume still holding the original root password from before the suspension. I can’t recover that value and I can’t reach the running mongod to change it myself, so I’m stuck until the password is rotated on your end.
5 months ago
I'm afraid the password cannot be rotated by Railway... can you look for history of where you saved it on your machine perhaps?
diinow11
I tried connecting externally with the exact MONGO_URL through mongosh on my machine:nginxand it still returns MongoServerError: Authentication failed. So a GUI like Compass would hit the same password mismatch.Everything points to the data volume still holding the original root password from before the suspension. I can’t recover that value and I can’t reach the running mongod to change it myself, so I’m stuck until the password is rotated on your end.
5 months ago
Also would love to make sure you know, that key is extremely private and should not be shared publicly. I can delete that message if you would like.
samgordon
I'm afraid the password cannot be rotated by Railway... can you look for history of where you saved it on your machine perhaps?
5 months ago
I did that and i couldn't find it unfornunately.
5 months ago
One other thing I'd love for you to test,
First, install the Railway CLI and run railway login then authenticate with your browser.
Second, head to the project and right click the mongo db instance and hit "Copy SSH Command"Head back to your terminal and enter that ssh command. See if that goes through
Attachments
noahd
Also would love to make sure you know, that key is extremely private and should not be shared publicly. I can delete that message if you would like.
5 months ago
Thank you
i removed it
5 months ago
Here's what you're going to do.
Go into the MongoDB service and change the start command to:
mongod --ipv6 --bind_ip ::,0.0.0.0 --noauth --setParameter diagnosticDataCollectionEnabled=false --setParameter enableLocalhostAuthBypass=0
Right click the service and copy the SSH command, paste that into your terminal.
Type the following commands:
mongosh
use admin
db.changeUserPassword("mongo", passwordPrompt())
Change MONGO_INITDB_ROOT_PASSWORD to be this new password.
Exit this window and change your start command back to:
mongod --ipv6 --bind_ip ::,0.0.0.0 --setParameter diagnosticDataCollectionEnabled=false
samgordon
Here's what you're going to do.Go into the MongoDB service and change the start command to:mongod --ipv6 --bind_ip ::,0.0.0.0 --noauth --setParameter diagnosticDataCollectionEnabled=false --setParameter enableLocalhostAuthBypass=0Right click the service and copy the SSH command, paste that into your terminal.Type the following commands:mongoshuse admindb.changeUserPassword("mongo", passwordPrompt())Change MONGO_INITDB_ROOT_PASSWORD to be this new password.Exit this window and change your start command back to:mongod --ipv6 --bind_ip ::,0.0.0.0 --setParameter diagnosticDataCollectionEnabled=false
5 months ago
Thank you so much
This helped.
Status changed to Solved brody • 5 months ago

