Everything runs fine locally when I run
netlify dev, but when I deploy to production I get a 502 error. I have checked my database and everything is getting updated properly in there when I visit different routes in my app. Cookies are even getting set in the browser, but the response from the server is returning a 502 error even though the response times are well below 10 seconds.
IMPORTANT NOTE: The database that I am using right now is a development database and it goes to sleep after about 30 minutes of inactivity and then it takes about 30 to 60 seconds to wake up after it receives a request. So the initial response will probably time out for you, but after the database is awake then the functions respond under 10 seconds.