Tested on postman.
Note: Looks like this issue occurs on Heroku when the size of the file you want to upload is large.
This happens when user is logged out: Post request to POST /books returns an html page structure instead of a response object. Also PUT /books/:bookID does this too sometimes. These are the only two endpoints I noticed does this. And they are the only two endpoints that have Cloudinary code in them... (I'm thinking it's related to cloudinary)
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
<title>Application Error</title>
<style media="screen">
html,
body,
iframe {
margin: 0;
padding: 0;
}
html,
body {
height: 100%;
overflow: hidden;
}
iframe {
width: 100%;
height: 100%;
border: 0;
}
</style>
</head>
<body>
<iframe src="//www.herokucdn.com/error-pages/application-error.html"></iframe>
</body>
</html>
2022-03-14T17:38:57.804725+00:00 app[web.1]: �[0mPOST /books �[33m403�[0m 0.650 ms - 96�[0m
2022-03-14T17:38:58.044194+00:00 heroku[router]: sock=backend at=error code=H18 desc="Server Request Interrupted" method=POST path="/books" host=buuks-express-api.herokuapp.com request_id=94e5ec60-bbda-4f0c-819b-008d486fb7f6 fwd="105.112.16.84" dyno=web.1 connect=0ms service=239ms status=503 bytes=310 protocol=https
{
"message": "You are Logged out. Please sign in to your account to continue",
"error": "Forbidden"
}