if you add 0.0.0.0 in mongo db it accepts requests from any IP
and it says handshake failed so its either
1)IP issue
2)taking too much time to load string from.env [faced by me in the paste] [but u r giving as string so there might not be any issue reg that
hope this will help
or if you want streamlit ip try catching it by making a request for the first time with wildcard and then use that ip ,ig this will work