Search code examples
node.jsapiherokubackend

heroku request timeout 503


I recently launched a nodejs project to heroku and the build was successful. heading to the default or initial page of my nodejs shows a message "hello this is backend" which is what I set it up to say. When I try to make requests though is when It starts to timeout for no reason. I suspected it would be a mongodb network access issue, I set network access to everyone, still in the same place. Heres my build log I get when I make requests. Any help is greatly appreciated.

2023-02-07T07:00:12.397821+00:00 app[web.1]: [0mGET /api/blogs/posts [0m-[0m - ms - -[0m
2023-02-07T07:00:12.400365+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/api/blogs/posts" host=blog-backend-0.herokuapp.com request_id=c42937a8-a290-4393-89a6-3e82dc382a3b fwd="96.2.91.62" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0 protocol=https
2023-02-07T07:08:02.319730+00:00 heroku[router]: at=info method=GET path="/api/blogs/posts/63bb5739b3df321e78e219e0" host=blog-backend-0.herokuapp.com request_id=523b9b8b-8a02-4009-b2ed-1855dceca104 fwd="96.2.91.62" dyno=web.1 connect=0ms service=10005ms status=304 bytes=940 protocol=https
2023-02-07T07:08:02.320404+00:00 app[web.1]: [0mGET /api/blogs/posts/63bb5739b3df321e78e219e0 [36m304[0m 10004.226 ms - -[0m
2023-02-07T23:19:39.802708+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=blog-backend-0.herokuapp.com request_id=f7841a6a-7135-42c5-ad4a-4991b9749b1b fwd="96.2.91.62" dyno=web.1 connect=0ms service=44ms status=404 bytes=873 protocol=https
2023-02-07T23:19:39.804862+00:00 app[web.1]: [0mGET /favicon.ico [33m404[0m 3.861 ms - 150[0m
2023-02-07T23:20:02.518798+00:00 heroku[router]: at=info method=GET path="/api/blogs/posts/63bb5739b3df321e78e219e0" host=blog-backend-0.herokuapp.com request_id=69f2f554-17ac-46f8-aad4-2698a666ef12 fwd="96.2.91.62" dyno=web.1 connect=0ms service=10038ms status=304 bytes=940 protocol=https
2023-02-07T23:20:02.519517+00:00 app[web.1]: [0mGET /api/blogs/posts/63bb5739b3df321e78e219e0 [36m304[0m 10034.051 ms - -[0m
2023-02-07T23:20:27.580101+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/api/blogs/posts/" host=blog-backend-0.herokuapp.com request_id=7e7fe49d-5a23-4f34-ab67-7ac0dc46516e fwd="96.2.91.62" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0 protocol=https
2023-02-07T23:20:27.584117+00:00 app[web.1]: [0mGET /api/blogs/posts/ [0m-[0m - ms - -[0m

Solution

  • the problem was that I wasnt taking out the .env file from the .gitignore so it never had access to the port number or mongoDB string.