If you are using a database like ngrok on your local machine, make sure that you are getting the new forwarding address after restarting the server.
Took me a while to find out why I couldn't use parts of my app all of a sudden even though my code looked fine. I restarted my ngrok server, replaced the forwarding address in my server file, and it was fixed! :)