503 (Service Unavailable) for MERN stack app deployed on heroku - heroku

I have deployed my MERN stack app on heroku but now I am having a trouble while making a POST request to my backend through a form.
I have run the command heroku logs --tail
and I am getting the following errors
at=error code=H12 desc="Request timeout" method=POST path="/api/auth" host=still-island-81891.herokuapp.com request_id=b151ea11-23e7-4677-a6d9-d8fd9a213098 fwd="47.30.225.200" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0 protocol=https
Thanks!

Related

MeteorJS app causing H12 and Application Error

Really hoping some Meteor/Heroku experts can give some advises.
We have a MeteorJS app, hosted on Heroku. It is already using an expensive Professional M Dyno with a lot of memory capacity. But recently, at one point of time, it triggered a lot of H12 Request time out and then Heroku presented Application error page to all visitors.
This resolved after server is restarted. But we are running out of ideas on how to prevent this issue in the future.
We kind of confirmed that there was no obvious long running tasks, like email sending, files uploading.
And then, we can no longer trace deeper what happened right before the Application Error.
To make debugging even harder, even though we can see a lot of 30 seconds response time in the charts before the application error, it means nothing to us because we have seen these 30 seconds charts everyday. We understand that this is because Meteor is using socket connection which falls back to long polling and it is natural that a lot of 30 seconds response is recorded in the chart.
This is a snapshot of the router logs of the H12 errors:
366 <158>1 2022-06-15T06:20:35.674213+00:00 heroku router - - at=error code=H12 desc="Request timeout" method=POST path="/sockjs/859/upwpunj4/xhr" host=www.website.com request_id=dea10dbf-919a-440d-afbb-87f24d6b8bea fwd="37.19.205.195,172.70.222.217" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0 protocol=http
373 <158>1 2022-06-15T06:20:45.911709+00:00 heroku router - - at=error code=H15 desc="Idle connection" method=GET path="/sockjs/696/qq_433yi/websocket" host=www.website.com request_id=761c71de-0f1f-4fac-ad31-db8aed615f54 fwd="151.192.225.202,172.70.92.184" dyno=web.1 connect=0ms service=3220877ms status=503 bytes= protocol=http
398 <158>1 2022-06-15T06:20:47.934103+00:00 heroku router - - at=error code=H15 desc="Idle connection" method=GET path="/sockjs/415/mk2hh_st/websocket" host=www.website.com request_id=633aa897-ebc2-4069-b201-6aacc36dc18b fwd="2404:e801:2001:1729:dd09:de8e:a8ff:7969,172.70.142.233" dyno=web.1 connect=0ms service=1720563ms status=503 bytes= protocol=http
394 <158>1 2022-06-15T06:20:48.584366+00:00 heroku router - - at=error code=H15 desc="Idle connection" method=GET path="/sockjs/037/5fz5sxeg/websocket" host=www.website.com request_id=253e05d2-76f4-4b53-ae74-3ad252084460 fwd="2001:f40:90f:ed3:d1ea:de0:28ba:c91,162.158.163.228" dyno=web.1 connect=0ms service=1225547ms status=503 bytes= protocol=http
340 <158>1 2022-06-15T06:20:50.298552+00:00 heroku router - - at=error code=H12 desc="Request timeout" method=GET path="/" host=www.website.com request_id=59cd33a6-e155-4645-9539-8eb2e759b915 fwd="176.9.151.26,172.68.50.111" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0 protocol=http
430 <158>1 2022-06-15T06:20:54.99057+00:00 heroku router - - at=error code=H12 desc="Request timeout" method=GET path="/cfs/files/images/AmZNefJYyKWBLuBdb/04.png?token=eyJhdXRoVG9rZW4iOiIifQ%3D%3D&store=thumbs" host=www.website.com request_id=8e9bb915-ea06-4698-9cf6-15f311422c82 fwd="207.46.13.66,162.158.107.186" dyno=web.1 connect=0ms service=30001ms status=503 bytes=0 protocol=http
371 <158>1 2022-06-15T06:20:55.417353+00:00 heroku router - - at=error code=H12 desc="Request timeout" method=GET path="/?pg=news/20110628_182815&id=844" host=www.website.com request_id=3d7d0829-0922-4f63-b031-a407b2d97f0d fwd="192.99.15.34,108.162.241.9" dyno=web.1 connect=0ms service=30001ms status=503 bytes=0 protocol=http
Any guidance or tips is greatly appreciated.

how to solve Heroku Deployment Request timeout error?

I was trying to deploy my dashboard on heroku but after I finished I got Request timeout error
I got an Application error and search a lot but still have the same problem of time out and quota memory exceeded
Here is the error from the activity log:
2022-05-02T19:12:39.725777+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=ukraineinvasion.herokuapp.com request_id=fc485f9
6-0c39-416e-914a-93a3c9e1b6e8 fwd="41.46.189.30" dyno=web.1 connect=0ms service=30004ms status=503 bytes=0 protocol=https
2022-05-02T19:12:40.714784+00:00 app[web.1]: Dash is running on http://127.0.0.1:59351/

Blank page in browser with Unexpected token '<' in console

I have a problem with deploying Strapi application on Heroku. Both local and Heroku Strapi setups are using Postgres database.
Can't see any errors in Heroku logs, just a blank page in browser. Brpwser's console has these two errors:
Uncaught SyntaxError: Unexpected token '<' runtime~main.8073a043.js:1
Uncaught SyntaxError: Unexpected token '<' main.abbe0ac9.chunk.js:1
Heroku logs:
2020-12-11T15:26:03.986177+00:00 heroku[web.1]: State changed from starting to up
2020-12-11T15:26:03.916838+00:00 app[web.1]: INFO: Accepting connections at http://localhost:58777
2020-12-11T15:26:04.470749+00:00 heroku[router]: at=info method=GET path="/" host=john-strapi-postgres.herokuapp.com request_id=8783501f-3d9f-4986-bb44-6648a93d8105 fwd="68.82.27.99" dyno=web.1 connect=1ms service=24ms status=304 bytes=85 protocol=https
2020-12-11T15:26:04.561029+00:00 heroku[router]: at=info method=GET path="/admin/runtime~main.8073a043.js" host=john-strapi-postgres.herokuapp.com request_id=008157f5-a2ff-4738-9a8c-8ef4ac76a2d8 fwd="68.82.27.99" dyno=web.1 connect=1ms service=3ms status=304 bytes=85 protocol=https
2020-12-11T15:26:04.558537+00:00 heroku[router]: at=info method=GET path="/admin/main.abbe0ac9.chunk.js" host=john-strapi-postgres.herokuapp.com request_id=aa2e15a8-e001-4333-a195-f669ddcaac74 fwd="68.82.27.99" dyno=web.1 connect=1ms service=5ms status=304 bytes=85 protocol=https
2020-12-11T15:26:04.666249+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=john-strapi-postgres.herokuapp.com request_id=f2342dac-0347-4b0b-a4e4-89f0a425a98a fwd="68.82.27.99" dyno=web.1 connect=0ms service=6ms status=304 bytes=85 protocol=https
Local Strapi application runs perfectly fine.
Node v. 14.5.1
NPM v. 6.14.8
Strapi v. 3.3.4
Windows 10

Heroku docker spring boot image error 503 H14

I few days ago I was trying to deploy a docker image of a spring boot app into heroku.
I have the following docker file:
FROM openjdk:8-jdk-alpine
LABEL maintainer="gabigarciagar#gmail.com"
VOLUME /tmp
COPY ./target/*.jar PetApp_Auth.jar
CMD [ "java","-Xmx300m","-Xss512k","-XX:CICompilerCount=2","-Dfile.encoding=UTF-8","-Dspring.profiles.active=heroku","-Djava.security.egd=file:/dev/./urandom","-jar","/PetApp_Auth.jar" ]
also in my application.properties for a heroku profile i have:
spring.profiles.active=heroku
server.port=${PORT}
server.servlet.context-path=/
then i execute the following commands and everithig looks nice:
$ heroku container:push petapp-authserver -a petapp-authserver
Your image has been successfully pushed. You can now release it with the 'container:release' command.
$ heroku container:release petapp-authserver -a petapp-authserver
Releasing images petapp-authserver to petapp-authserver... done
Also the heroku log show that the app is up and also heroku ps
the database connection is perfect also
$ heroku ps -a petapp-authserver
=== petapp-authserver (Free): java -Xmx300m -Xss512k -XX:CICompilerCount\=2 -Dfile.encoding\=UTF-8 -Dspring.profiles.active\=heroku -Djava.security.egd\=file:/dev/./urandom -jar /PetApp_Auth.jar (1)
petapp-authserver.1: up 2020/03/06 21:09:51 +0100 (~ 1m ago)
Then when i try to see swagger-ui o /actuator/health i get the following:
2020-03-06T20:11:58.149484+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=petapp-authserver.herokuapp.com request_id=e88c2499-b1de-4284-a649-1d8df19ae6c0 fwd="79.147.107.220" dyno= connect= service= status=503 bytes= protocol=https
2020-03-06T20:11:59.443315+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=petapp-authserver.herokuapp.com request_id=9fa4951a-365c-4b9b-bf63-94f8d6792249 fwd="79.147.107.220" dyno= connect= service= status=503 bytes= protocol=https
2020-03-06T20:12:08.185495+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/actuator/health" host=petapp-authserver.herokuapp.com request_id=c4c3382b-43b7-494c-9259-630ce24eb8a4 fwd="79.147.107.220" dyno= connect= service= status=503 bytes= protocol=https
2020-03-06T20:12:08.697245+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=petapp-authserver.herokuapp.com request_id=b044b6fe-ba8d-4b3d-8c7c-8e477ea7b609 fwd="79.147.107.220" dyno= connect= service= status=503 bytes= protocol=https
2020-03-06T20:12:12.943276+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/actuator/health" host=petapp-authserver.herokuapp.com request_id=6ac05b16-148d-4849-a857-c3d6bed9fe01 fwd="79.147.107.220" dyno= connect= service= status=503 bytes= protocol=http
2020-03-06T20:12:13.637589+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=petapp-authserver.herokuapp.com request_id=2c01dbaa-18c5-46f8-8f43-f91ee372a5eb fwd="79.147.107.220" dyno= connect= service= status=503 bytes= protocol=http
2020-03-06T20:12:23.492570+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/swagger-ui.html" host=petapp-authserver.herokuapp.com request_id=2850eb70-1bd5-4737-9505-d59184e95946 fwd="79.147.107.220" dyno= connect= service= status=503 bytes= protocol=http
2020-03-06T20:12:23.878827+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=petapp-authserver.herokuapp.com request_id=f83acdef-840a-4e2e-824c-183cfdc50273 fwd="79.147.107.220" dyno= connect= service= status=503 bytes= protocol=http
as heroku web said https://devcenter.heroku.com/articles/error-codes#h14-no-web-dynos-running
i execute:
heroku ps:scale petapp-authserver=1 -a petapp-authserver
Scaling dynos... done, now running petapp-authserver at 1:Free
And same error
What I am doing wrong??
I was able to deploy the jar directly and it works
heroku deploy:jar PetApp_AuthServer-V-0.0.0.jar -a petapp-authserver
Uploading PetApp_AuthServer-V-0.0.0.jar
-----> Packaging application...
- app: petapp-authserver
- including: PetApp_AuthServer-V-0.0.0.jar
-----> Creating build...
- file: slug.tgz
- size: 46MB
-----> Uploading build...
- success
-----> Deploying...
remote:
remote: -----> heroku-deploy app detected
remote: -----> Installing JDK 1.8... done
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 96.8M
remote: -----> Launching...
remote: Released v12
remote: https://petapp-authserver.herokuapp.com/ deployed to Heroku
remote:
-----> Done
2020-03-13T19:25:13.683982+00:00 heroku[router]: at=info method=POST path="/auth/login" host=petapp-authserver.herokuapp.com request_id=ef9a29b6-c10c-4b82-8088-711d448c3a32 fwd="88.17.74.86" dyno=web.1 connect=1ms service=362ms status=200 bytes=878 protocol=https
2020-03-13T19:25:13.780163+00:00 heroku[router]: at=info method=GET path="/webjars/springfox-swagger-ui/fonts/titillium-web-v6-latin-600.woff2" host=petapp-authserver.herokuapp.com request_id=f2f6334d-2663-49b0-bd28-b5d287e79b68 fwd="88.17.74.86" dyno=web.1 connect=1ms service=13ms status=200 bytes=12634 protocol=https
Why it perfecty works with jar deploy and not with docker??
I have also tried:
Gabi#MSI MINGW64 /d/Proyectos/PetApp/Back/PetApp_AuthServer (develop)
$ heroku container:release web petapp-authserver -a petapp-authserver
! Expected response to be successful, got 404
Gabi#MSI MINGW64 /d/Proyectos/PetApp/Back/PetApp_AuthServer (develop)
$ heroku container:release web petapp-authserver -a petapp-authserver
! Expected response to be successful, got 404
Gabi#MSI MINGW64 /d/Proyectos/PetApp/Back/PetApp_AuthServer (develop)
$ heroku container:release petapp-authserver -a petapp-authserver
Releasing images petapp-authserver to petapp-authserver... done
Thanks in advance
Finally I solved the question.
The point is that the image in heroku must be named same as the process type, in this case web!
so there are two options. Build and pushing the image by using:
heroku container:push web -a petapp-authserver
or create the image locally and the tag it as registry.heroku.com/petapp-authserver/web
docker tag petapp-authserver registry.heroku.com/petapp-authserver/web
docker push registry.heroku.com/petapp-authserver/web
The push refers to repository [registry.heroku.com/petapp-authserver/web]
eb03575d1edf: Preparing
ceaf9e1ebef5: Preparing
9b9b7f3d56a0: Preparing
f1b5933fe4b5: Preparing
eb03575d1edf: Layer already exists
9b9b7f3d56a0: Layer already exists
f1b5933fe4b5: Layer already exists
ceaf9e1ebef5: Layer already exists
latest: digest: sha256:4c0ae2bba092c07bbd89394216b0bf78f458ba3583e63c8d15e01f6b07d6933e size: 1159
heroku container:release web -a petapp-authserver
Releasing images web to petapp-authserver... done
Now my containers are perfectly running in docker!!
Thank you all
In your Procfile or your heroku.yml you have not specified a web worker.
2020-03-06T20:12:23.878827+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=petapp-authserver.herokuapp.com request_id=f83acdef-840a-4e2e-824c-183cfdc50273 fwd="79.147.107.220" dyno= connect= service= status=503 bytes= protocol=http
For containers you should use heroku.yml. Procfile might even be ignored.
https://devcenter.heroku.com/articles/build-docker-images-heroku-yml
Doing this will get rid of your current H14 errors.
Key point is the process type.
For example, when you deploy the jar and runs it, you can see at your logs:
remote: -----> Discovering process types
remote: Procfile declares types -> web
But you don't see it when using release because you haven't specified a process type.
Can you try to run the release command like this and see if it works?
heroku container:release web petapp-authserver -a petapp-authserver
web is the process type!

Deployment Issue with Spring Boot on Heroku

This is my github repo https://github.com/ArslanAnjum/angularSpringApi which I want to deploy on heroku. The problem is that it is working fine locally but not working on heroku. Can anyone help me out why its not working on heroku?
Heroku link is https://angular-spring-api.herokuapp.com/login . Its giving error that page not found.
This is from the logs of heroku with command heroku logs --tail
2017-11-10T14:06:53.418723+00:00 heroku[router]: at=info method=GET path="/login" host=angular-spring-api.herokuapp.com request_id=cd5bf927-f868-4289-a79d-82aa0c97607b fwd=
"182.180.173.165" dyno=web.1 connect=0ms service=169ms status=404 bytes=715 protocol=https

Resources