So I just had a bunch of problems just getting through exercise 1 with Mongoose throwing “unhandled promise” exceptions. I figured I’d write it up.
Turned out that while I was creating my database and database user, I created two problems.
1: Database user… I used a password manager to generate and store a random password. It used a special char (&) that doesn’t work well in URLs. I considered escaping it, but decided to just change the password.
2: I started the database while using my phone as a mobile hotspot during my commute. Continued it while on the company network at lunch.
My connections were failing due to me whitelisting my IP address from the phone, but not my IP on Glitch. I figured even if I got the IP for my app from Glitch, I wasn’t sure that would remain good.
Whitelisting all IP addresses (0.0.0.0) is not the best security. MongoDB will even send you a notice to make sure you know what you did. But since this is just for practice and it’s a free tier db, you can be a little more relaxed… so long as you understand what you’re doing, why you’re doing it, and you don’t make a habit of it.
My last problem was remembering to specify the Glitch project properly
Hope this helps someone.