Users are saved to MongoDB, but fails to redirect and I get an error after



Hi there,

I am doing the web dev bootcamp project, and ran across a problem with authentication.

Basically, my users are being saved to Mongo (I can go into mongo and check manually) but when I do a res.redirect to a page, it hangs for a couple minutes until giving me a 502 bad gateway error.

Here’s my basic authentication code (see JS) and the error page I see (as raw html - in the HTML window):

I’ve seen a bunch of other posts but none of them really worked.