Everything works fine while I was in development mode and now when I uploaded my app to heroku I keep getting this error, and the only thing it says is that is a Request timeout
.
heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/visited/posts" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0 protocol=https
But I dont know the reason I get timeout because it was working alright in development. Might have something to do with the fact that I am on a free dyno?
What I've done so far is to make all the requests in my backed async, but I still get the error. And it happens on several endpoints.
example
const Comment = require('../../models/Comment');
exports.getComments = async (req, res) => {
await Comment
.find({ postId: req.params.postid })
.populate('author')
.exec((error, comments) => {
if (!comments) {
return res.status(404).json({
message: 'No comments found for this post',
});
}
if (error) {
return res.json({ message: error.message, });
}
res.status(200).json({
comments,
});
})
};