Heroku app deploy failed due to unknown reason - python-3.x

I have been trying to deploy an app to Heroku
it has been deployed but says application error
LOGS:-
2020-10-06T04:14:51.490040+00:00 heroku[web.1]: Starting process with command `gunicorn great-usernames:wsgi`
2020-10-06T04:14:53.853073+00:00 app[web.1]: bash: gunicorn: command not found
2020-10-06T04:14:53.889337+00:00 heroku[web.1]: Process exited with status 127
2020-10-06T04:14:53.928653+00:00 heroku[web.1]: State changed from starting to crashed
2020-10-06T04:15:00.441714+00:00 heroku[router]: at=info code=H81 desc="Blank app" method=GET path="/" host=gg-usernames.herokuapp.com request_id=508d3db8-7a0b-4469-b22c-124117a6ffa9 fwd="49.37.6.95" dyno= connect= service= status=502 bytes= protocol=https
2020-10-06T04:15:00.982496+00:00 heroku[router]: at=info code=H81 desc="Blank app" method=GET path="/favicon.ico" host=gg-usernames.herokuapp.com request_id=d644c379-098b-4b37-927b-2578ca65537b fwd="49.37.6.95" dyno= connect= service= status=502 bytes= protocol=https
2020-10-06T04:15:14.860562+00:00 heroku[router]: at=info code=H81 desc="Blank app" method=GET path="/" host=gg-usernames.herokuapp.com request_id=d2de73e7-9a89-453b-9e5f-0942f22e3ee6 fwd="49.37.6.95" dyno= connect= service= status=502 bytes= protocol=https
2020-10-06T04:15:15.333167+00:00 heroku[router]: at=info code=H81 desc="Blank app" method=GET path="/favicon.ico" host=gg-usernames.herokuapp.com request_id=43020ef1-b277-40a7-8555-2b71418f1917 fwd="49.37.6.95" dyno= connect= service= status=502 bytes= protocol=https
2020-10-06T04:16:38.957562+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=gg-usernames.herokuapp.com request_id=97723735-ca99-4b00-818d-c36ac77867d6 fwd="49.37.6.95" dyno= connect= service= status=503 bytes= protocol=https
2020-10-06T04:16:39.649714+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=gg-usernames.herokuapp.com request_id=ca46ab12-0bf2-4e71-b3d5-f6760fd040d1 fwd="49.37.6.95" dyno= connect= service= status=503 bytes= protocol=https
2020-10-06T04:21:08.498502+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=gg-usernames.herokuapp.com request_id=0a99c7bf-2a90-4bba-bbf1-46fc85bd3cc7 fwd="49.37.6.95" dyno= connect= service= status=503 bytes= protocol=https
2020-10-06T04:21:09.153869+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=gg-usernames.herokuapp.com request_id=ed12acab-3296-4a09-b7fe-7b1f8fbcb25f fwd="49.37.6.95" dyno= connect= service= status=503 bytes= protocol=https
thanks in advance

Specify gunicorn and version in the requirements.txt
gunicorn==20.0.4

Related

Application error at heroku first deployment

I am trying to deploy the react.js project on Heroku first time but I faced an Application error after my deployment
here are the complete Heroku logs which I got in CLI
but I can't figure it out kindly have a look at it and help me to fix it
2022-03-27T21:38:28.785305+00:00 app[web.1]: errno: -2,
2022-03-27T21:38:28.785305+00:00 app[web.1]: code: 'ENOENT',
2022-03-27T21:38:28.785305+00:00 app[web.1]: syscall: 'spawn xdg-open',
2022-03-27T21:38:28.785306+00:00 app[web.1]: path: 'xdg-open',
2022-03-27T21:38:28.785306+00:00 app[web.1]: spawnargs: [ 'http://localhost:5473' ]
2022-03-27T21:38:28.785306+00:00 app[web.1]: }
2022-03-27T21:38:28.952616+00:00 heroku[web.1]: Process exited with status 1
2022-03-27T21:38:29.035319+00:00 heroku[web.1]: State changed from up to crashed
2022-03-27T21:38:30.362490+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=prashantkr006-portfolio.herokuapp.com request_id=32017955-d828-4cb3-83bb-5549ef9b708d fwd="124.253.43.194" dyno= connect= service= status=503 bytes= protocol=https
2022-03-27T21:38:30.929163+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=prashantkr006-portfolio.herokuapp.com request_id=536688a3-05d6-4ae5-8e71-9a7416288a7c fwd="124.253.43.194" dyno= connect= service= status=503 bytes= protocol=https
2022-03-27T21:38:34.193164+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=prashantkr006-portfolio.herokuapp.com request_id=63109b08-cfb0-46c3-b456-49cfffcb4b2c fwd="124.253.43.194" dyno= connect= service= status=503 bytes= protocol=https
2022-03-27T21:38:34.734662+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=prashantkr006-portfolio.herokuapp.com request_id=f1db7ca5-c99c-4048-a461-ac45a649d965 fwd="124.253.43.194" dyno= connect= service= status=503 bytes= protocol=https
2022-03-27T21:38:36.322456+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=prashantkr006-portfolio.herokuapp.com request_id=1fe2ea64-25aa-4424-aa92-b314327af931 fwd="124.253.43.194" dyno= connect= service= status=503 bytes= protocol=https
2022-03-27T21:38:36.933721+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=prashantkr006-portfolio.herokuapp.com request_id=d5e392cd-1ccd-42b7-aa11-074c69da34b4 fwd="124.253.43.194" dyno= connect= service= status=503 bytes= protocol=https
2022-03-27T21:38:37.425993+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=prashantkr006-portfolio.herokuapp.com request_id=dbdd86bd-4a02-485e-9032-6df69426502a fwd="124.253.43.194" dyno= connect= service= status=503 bytes= protocol=https
2022-03-27T21:50:02.264561+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=prashantkr006-portfolio.herokuapp.com request_id=53022457-3a00-423f-ae40-37e33e685d23 fwd="124.253.43.194" dyno= connect= service= status=503 bytes= protocol=https
2022-03-27T21:50:02.898755+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=prashantkr006-portfolio.herokuapp.com request_id=536c5ee9-ec09-4360-8821-c8248db464a5 fwd="124.253.43.194" dyno= connect= service= status=503 bytes= protocol=https
2022-03-27T21:52:42.850643+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=prashantkr006-portfolio.herokuapp.com request_id=99a80e06-a2e5-4ae7-800a-a945e3c58ff2 fwd="124.253.43.194" dyno= connect= service= status=503 bytes= protocol=https
2022-03-27T21:52:43.403302+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=prashantkr006-portfolio.herokuapp.com request_id=c830cdd8-66ca-446b-a6cb-ad8308759ffe fwd="124.253.43.194" dyno= connect= service= status=503 bytes= protocol=https```
how to fix it?
From what I understand, your issue is similar to this one :
have an error when deploy react app in heroku
By the way, if this concerns a react.js app you should edit your post tags, you put node.js instead of react.js

"Couldn't find that process type (web)", but I have defined a web process in my Procfile

I an trying to host my Django application on Heroku.
My log says "No web processes running", so I tried to scale up my web dynos by running heroku ps:scale web=1. Unfortunately, this gave a new error:
Scaling dynos...! ! Couldn't find that process type (web)
I have defined a web process in my Procfile:
��web : gunicorn grouppublishingindia.wsgi --log-file -
Here are the runtime logs:
2021-01-29T19:05:21.512000+00:00 heroku[run.6267]: Starting process with command `python manage.py migrate`
2021-01-29T19:05:29.245349+00:00 heroku[run.6267]: Process exited with status 0
2021-01-29T19:05:29.281276+00:00 heroku[run.6267]: State changed from up to complete
2021-01-29T19:12:55.201869+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=grouppublishingindia.herokuapp.com request_id=1cd6be75-9711-4890-ac37-542c02731f37 fwd="103.252.25.76" dyno= connect= service= status=503 bytes= protocol=https
2021-01-29T19:13:01.315149+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=grouppublishingindia.herokuapp.com request_id=9cb635ac-f755-437c-9706-b956967f9f32 fwd="103.252.25.76" dyno= connect= service= status=503 bytes= protocol=https
2021-01-29T19:14:17.641461+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=grouppublishingindia.herokuapp.com request_id=d8ed6b4d-3fe4-4c3a-95d7-fc1a4bc7cd52 fwd="103.252.25.76" dyno= connect= service= status=503 bytes= protocol=https
2021-01-29T19:14:20.774568+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=grouppublishingindia.herokuapp.com request_id=61570fe1-d1d3-41d0-846d-8f482e9f8bfe fwd="103.252.25.76" dyno= connect= service= status=503 bytes= protocol=https
2021-01-29T19:16:09.470063+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=grouppublishingindia.herokuapp.com request_id=19bd2fb7-9739-4a80-b881-759f36c0e5b6 fwd="103.252.25.76" dyno= connect= service= status=503 bytes= protocol=https
2021-01-29T19:16:13.909655+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=grouppublishingindia.herokuapp.com request_id=321e5a3a-798a-42ce-a9ab-39786097717f fwd="103.252.25.76" dyno= connect= service= status=503 bytes= protocol=https
2021-01-29T19:25:36.896690+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=grouppublishingindia.herokuapp.com request_id=13206d28-14c4-4fc1-b57a-2d6b82ab05c9 fwd="103.252.25.76" dyno= connect= service= status=503 bytes= protocol=https
2021-01-29T19:25:38.638019+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=grouppublishingindia.herokuapp.com request_id=307e0608-6e83-480a-98f5-bf1454408672 fwd="103.252.25.76" dyno= connect= service= status=503 bytes= protocol=https
2021-01-29T19:25:47.279682+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/admin" host=grouppublishingindia.herokuapp.com request_id=309fce6e-4834-4560-b7e0-3895ccdb90d3 fwd="103.252.25.76" dyno= connect= service= status=503 bytes= protocol=https
2021-01-29T19:25:48.583128+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=grouppublishingindia.herokuapp.com request_id=a1d0de6a-182e-4aca-83b4-e8ebdee8261f fwd="103.252.25.76" dyno= connect= service= status=503 bytes= protocol=https
2021-01-29T19:26:09.418186+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/admin/login" host=grouppublishingindia.herokuapp.com request_id=7f80cab5-bdc8-4097-83b9-12151a53ce48 fwd="103.252.25.76" dyno= connect= service= status=503 bytes= protocol=https
2021-01-29T19:26:10.777570+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=grouppublishingindia.herokuapp.com request_id=94b74270-ce45-4bdb-9554-1d18278df029 fwd="103.252.25.76" dyno= connect= service= status=503 bytes= protocol=https
2021-01-29T19:28:40.734847+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/admin/login" host=grouppublishingindia.herokuapp.com request_id=6d20d9fa-e28e-4e1f-8d6d-373d1a4b376c fwd="103.252.25.76" dyno= connect= service= status=503 bytes= protocol=https
2021-01-29T19:28:42.085017+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=grouppublishingindia.herokuapp.com request_id=7fc8b4fa-87d9-4e17-9bac-5ecf4f5074be fwd="103.252.25.76" dyno= connect= service= status=503 bytes= protocol=https
2021-01-29T19:28:56.508972+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=grouppublishingindia.herokuapp.com request_id=4abf5e65-d489-4012-8f31-c252eba7b52a fwd="103.252.25.76" dyno= connect= service= status=503 bytes= protocol=https
2021-01-29T19:28:57.316760+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=grouppublishingindia.herokuapp.com request_id=9a96ef97-5e10-428a-a200-99e5b5a15d97 fwd="103.252.25.76" dyno= connect= service= status=503 bytes= protocol=https
2021-01-29T19:33:52.810241+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=grouppublishingindia.herokuapp.com request_id=c6d4e435-d6cc-4108-a773-878f3456cd7b fwd="103.252.25.76" dyno= connect= service= status=503 bytes= protocol=https
2021-01-29T19:33:54.091221+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=grouppublishingindia.herokuapp.com request_id=31539be1-c151-4eed-859b-6dec7af9233c fwd="103.252.25.76" dyno= connect= service= status=503 bytes= protocol=https
2021-01-29T20:17:16.061323+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=grouppublishingindia.herokuapp.com request_id=37e1cc44-bb1e-4b13-b4ef-09409de1d34d fwd="103.252.25.76" dyno= connect= service= status=503 bytes= protocol=https
2021-01-29T20:17:17.915649+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=grouppublishingindia.herokuapp.com request_id=eb2cb4a9-6313-431a-a36e-2653f68787ea fwd="103.252.25.76" dyno= connect= service= status=503 bytes= protocol=https
2021-01-29T20:40:54.627487+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=grouppublishingindia.herokuapp.com request_id=070ea498-6e5d-4712-984e-a7d5cbd27105 fwd="103.252.25.76" dyno= connect= service= status=503 bytes= protocol=https
2021-01-29T20:40:55.709483+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=grouppublishingindia.herokuapp.com request_id=7631e771-5802-4f2d-8a61-a4b308b2b985 fwd="103.252.25.76" dyno= connect= service= status=503 bytes= protocol=https
2021-01-29T20:42:53.761946+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=grouppublishingindia.herokuapp.com request_id=33998968-5c6c-48a0-b393-1b4d0d6545a4 fwd="103.252.25.76" dyno= connect= service= status=503 bytes= protocol=https
2021-01-29T20:42:54.387231+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=grouppublishingindia.herokuapp.com request_id=ad62faad-3231-4fe8-89e4-2c0188627923 fwd="103.252.25.76" dyno= connect= service= status=503 bytes= protocol=https
And here are my settings, in case they help:
"""
Django settings for grouppublishingindia project.
Generated by 'django-admin startproject' using Django 3.1.1.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
import os
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
TEMPLATE_DIR = os.path.join(BASE_DIR,'templates')
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = 'grouppublishingindiaoffice#gmail.com'
EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_HOST_PASSWORD')
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = **************************************
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = ['grouppublishingindia.herokuapp.com','.grouppublishingindia.com']
# Application definition
INSTALLED_APPS = [
'django.contrib.auth',
'Inventory',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'crispy_forms',
'debug_toolbar',
'import_export',
'django.contrib.admin',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware'
]
CRISPY_TEMPLATE_PACK = "bootstrap4"
ROOT_URLCONF = 'grouppublishingindia.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'grouppublishingindia.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
DATABASES = {
'default':{
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
import dj_database_url
db_from_env = dj_database_url.config()
DATABASES['default'].update(db_from_env)
#DATABASES['default']['CONN_MAX_AGE'] = 500
# Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.1/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_URL = '/static/'
LOGIN_REDIRECT_URL = "contenu"
#SMTP (Simple Mail Transfert Protcole) Configuration
CORS_REPLACE_HTTPS_REFERER = True
HOST_SCHEME = "https://"
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
SECURE_SSL_REDIRECT = True
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SECURE_HSTS_SECONDS = 1000000
SECURE_FRAME_DENY = True
The error states no web process is running (code H14)
There are two possibilities for this issue:
You have scaled down the number of web dynos to 0.
To solve this problem, simply run on your terminal: heroku ps:scale web=1 or heroku ps:scale web=1 -a [name of your heroku app] (if you have multiple apps.
You did not define a web process in your Procfile.
You need to define at the root of your Django project a file called Procfile that will describe your web processes and worker processes.
This file should look like this:
release: ./release.sh
web: gunicorn config.wsgi
worker: celery worker --app config.celery.app
In your case, it will probably be as simple as:
web: gunicorn {name-of-your-project}.wsgi
the WSGI.py is a file located within your project folder
Make sure to go through the Django configuration on Heroku documentation as you will need to install the python package for django-heroku and gunicorn.
Your Procfile has some weird encoding:
��web : gunicorn grouppublishingindia.wsgi --log-file -
Those � characters shouldn't be there. Please edit it to contain only
web: gunicorn grouppublishingindia.wsgi --log-file -
then save it with UTF-8 encoding. Commit that change and redeploy.

Application error when deploying website to Heroku

My first time deploying the website I got a long error as shown below.
2020-09-25T07:31:36.727714+00:00 heroku[web.1]: State changed from starting to crashed
2020-09-25T07:31:36.730015+00:00 heroku[web.1]: State changed from crashed to starting
2020-09-25T07:31:40.230036+00:00 heroku[web.1]: Starting process with command `node server.js`
2020-09-25T07:31:43.021415+00:00 heroku[web.1]: Process exited with status 1
2020-09-25T07:31:43.061920+00:00 heroku[web.1]: State changed from starting to crashed
2020-09-25T07:31:44.106774+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=secure-coast-24568.herokuapp.com request_id=3ba32d6b-e60d-4566-8a67-bf06d6957146 fwd="116.88.43.115" dyno= connect= service= status=503 bytes= protocol=https
2020-09-25T07:31:44.535220+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=secure-coast-24568.herokuapp.com request_id=2e8669b0-19cb-43aa-90c8-1e1770aa3e6a fwd="116.88.43.115" dyno= connect= service= status=503 bytes= protocol=https
2020-09-25T07:36:38.651280+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=secure-coast-24568.herokuapp.com request_id=0d39c46b-d0d8-4bfb-9516-1c8fae89dce6 fwd="116.88.43.115" dyno= connect= service= status=503 bytes= protocol=https
2020-09-25T07:36:39.102621+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=secure-coast-24568.herokuapp.com request_id=9b23f6b1-e2ec-4f12-8b25-cb000a229675 fwd="116.88.43.115" dyno= connect= service= status=503 bytes= protocol=https
2020-09-25T07:48:16.835509+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=secure-coast-24568.herokuapp.com request_id=956d30e4-a981-48fd-9ec9-2598975d3e1d fwd="116.88.43.115" dyno= connect= service= status=503 bytes= protocol=https
2020-09-25T07:48:17.345353+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=secure-coast-24568.herokuapp.com request_id=35947874-9055-4b74-ab76-31c4329e0c72 fwd="116.88.43.115" dyno= connect= service= status=503 bytes= protocol=https
I am not sure what is the cause of the problem but there were many others too getting the same errors which was rectified. Going through what they did to fix the problem I followed the steps but still got the same error. Currently the website is working 100% when used locally and I did multiple tests before I deployed it.
This is my server.js
const dotenv = require("dotenv");
const mongoose = require("mongoose");
const app = require("./app");
app.set("view engine", "ejs");
process.on("uncaughtException", () => {
process.exit(1);
});
dotenv.config({
path: "./config.env",
});
const DB = process.env.DATABASE.replace(
"<PASSWORD>",
process.env.DATABASE_PASSWORD
);
mongoose
.connect(DB, {
useNewUrlParser: true,
useCreateIndex: true,
useFindAndModify: false,
useUnifiedTopology: true,
})
.then(() => {
console.log("Success");
});
// Server
const port = process.env.PORT || "3000";
const server = app.listen(port, () => {
console.log("Server started");
});
// Handle all the errors in the async code that wasnt handle
process.on("unhandledRejection", () => {
server.close(() => {
process.exit(1);
});
});
My environment variables, e.g. DATABASE and DATABASE_PASSWORD, are set in a file called config.env, which is ignored via my .gitignore since it contains sensitive information.
Your config.env file should indeed be ignored. Sensitive information like your database credentials shouldn't be committed.
However, your application needs those values. On Heroku, the solution is to set config vars that get exposed to your application as environment variables. You can do this with the Heroku CLI, e.g.
heroku config:set DATABASE_PASSWORD=12345
or via the web dashboard.
Note that in most cases you shouldn't be setting database credentials manually on Heroku. Use a database addon and whatever config vars it sets, e.g. the Heroku Postgres service sets a variable called DATABASE_URL automatically.

Deploy App to Heroku

I have deployed my Node.js bot to heroku using the cli. WHen I try to open the app, it crashes with this error in log:
2018-02-20T12:34:24.132994+00:00 app[web.1]: npm ERR! drvinebot#1.0.0 start: `node app.js`
2018-02-20T12:34:24.133186+00:00 app[web.1]: npm ERR! Exit status 1
2018-02-20T12:34:24.133463+00:00 app[web.1]: npm ERR!
2018-02-20T12:34:24.133682+00:00 app[web.1]: npm ERR! Failed at the
drvinebot#1.0.0 start script.
2018-02-20T12:34:24.133887+00:00 app[web.1]: npm ERR! This is probably not a
problem with npm. There is likely additional logging output above.
2018-02-20T12:34:56.072459+00:00 heroku[router]: at=error code=H10 desc="App
crashed" method=GET path="/" host=drvinebot.herokuapp.com
request_id=8bf3595c-2ff8-4950-828c-0668e86e92bb fwd="106.203.157.18" dyno=
connect= service= status=503 bytes= protocol=https
2018-02-20T12:34:57.812751+00:00 heroku[router]: at=error code=H10 desc="App
crashed" method=GET path="/favicon.ico" host=drvinebot.herokuapp.com
request_id=f716154a-35e7-446d-b05d-bca3bc26c06c fwd="106.203.157.18" dyno=
connect= service= status=503 bytes= protocol=https
2018-02-20T12:35:43.707329+00:00 heroku[router]: at=error code=H10 desc="App
crashed" method=GET path="/" host=drvinebot.herokuapp.com
request_id=b0b38a2c-8164-44ca-bdf7-1f426bb327b3 fwd="106.203.157.18" dyno=
connect= service= status=503 bytes= protocol=https
2018-02-20T12:35:45.472294+00:00 heroku[router]: at=error code=H10 desc="App
crashed" method=GET path="/favicon.ico" host=drvinebot.herokuapp.com
request_id=44814f37-d547-49c3-9cb4-d2454cedcb29 fwd="106.203.157.18" dyno=
connect= service= status=503 bytes= protocol=https
2018-02-20T12:41:11.946966+00:00 heroku[router]: at=error code=H10 desc="App
crashed" method=GET path="/" host=drvinebot.herokuapp.com
request_id=af3e6bff-32d0-4a7a-8a72-b847d8b5b642 fwd="106.203.191.138" dyno=
connect= service= status=503 bytes= protocol=https
2018-02-20T12:41:13.583622+00:00 heroku[router]: at=error code=H10 desc="App
crashed" method=GET path="/favicon.ico" host=drvinebot.herokuapp.com
request_id=63f94976-a986-48cb-81c3-a46706f782dc fwd="106.203.191.138" dyno=
connect= service= status=503 bytes= protocol=https
Here's my package.json file:
"name": "drvinebot",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node app.js"
},
"author": "Joseph Joey",
"license": "UNLICENSED",
"dependencies": {
"express": "^4.16.2",
"helmet": "^3.11.0",
"twit": "^2.2.9"
}
}
Previously, I was using nodemon and app still crashed, so I changed my procfile to this:
web: npm start
to start the server using npm scripts. I don't seem to understand what's wrong here. Can someone help me out?
Thanks.

502 Bad Gateway nginx google app engine

I am building a NodeJS application using express here is my code:
var express = require('express');
var app = express();
var session = require('express-session');
var uuidv1 = require('uuid/v1');
require('dotenv').config();
var APIAI_TOKEN = process.env.APIAI_TOKEN;
var APIAI_SESSION_ID = uuidv1();
app.use(express.static(__dirname + '/views')); // html
app.use(express.static(__dirname + '/public')); // js, css, images
var server = require('http').createServer(app);
var port = process.env.port || 3000;
server.listen(port, function() {
console.log('Server listening at port: ', port);
// console.log(APIAI_SESSION_ID);
// console.log(APIAI_TOKEN);
});
app.use(session({
genid: function(req) {
return APIAI_SESSION_ID;
},
secret: 'secret',
saveUninitialized: true,
resave: true
}));
var io = require('socket.io')(server);
var apiai = require('apiai')(APIAI_TOKEN);
var rp = require('request-promise');
//#region Web UI
app.get('/', function(req, res) {
res.sendFile('index.html');
});
I start my app with node app and everything works perfectly on my localhost but when I deploy the app to Google App engine i get a 502 bad gateway error and when i check the log it happens at the app.get() method.
I even deployed it to Heroku server as well, the app is crashing at the same point. What could be wrong with my code?
Here is the log form Heroku server:
2017-11-01T16:35:57.528020+00:00 heroku[router]: at=error code=H10
desc="App crashed" method=GET path="/" host=ippcbot.herokuapp.com request_id=d956df30-8352-4a54-80e6-2aa1fc96276b fwd="197.210.37.211" dyno= connect= service= status=503 bytes= protocol=https
2017-11-01T16:35:58.138751+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=ippcbot.herokuapp.com request_id=96b2bf0d-df05-4d7e-9018-0b09e1dfa748 fwd="197.210.37.211" dyno= connect= service= status=503 bytes= protocol=https
Disconnected from log stream. There may be events happening that you do not see here! Attempting to reconnect...
2017-11-01T16:19:36.517868+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2017-11-01T16:19:36.513572+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2017-11-01T16:19:36.517927+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2017-11-01T16:19:36.584087+00:00 heroku[web.1]: Process exited with status 1
2017-11-01T16:19:36.607609+00:00 heroku[web.1]: State changed from starting to crashed
2017-11-01T16:20:47.248202+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=ippcbot.herokuapp.com request_id=41e9f39b-e908-4cee-a430-0d7f44a17590 fwd="197.210.37.211" dyno= connect= service= status=503 bytes= protocol=https
2017-11-01T16:20:47.891459+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=ippcbot.herokuapp.com request_id=9f244daf-7a3e-405e-b445-2fadd8b2735b fwd="197.210.37.211" dyno= connect= service= status=503 bytes= protocol=https
2017-11-01T16:35:13.187594+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=ippcbot.herokuapp.com request_id=455ccd5e-e389-49be-b892-e5e222c9864f fwd="197.210.37.211" dyno= connect= service= status=503 bytes= protocol=https
2017-11-01T16:35:13.805998+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=ippcbot.herokuapp.com request_id=112a5f08-632e-463d-b8e8-ed6de13b3596 fwd="197.210.37.211" dyno= connect= service= status=503 bytes= protocol=https
2017-11-01T16:35:57.528020+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=ippcbot.herokuapp.com request_id=d956df30-8352-4a54-80e6-2aa1fc96276b fwd="197.210.37.211" dyno= connect= service= status=503 bytes= protocol=https
2017-11-01T16:35:58.138751+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=ippcbot.herokuapp.com request_id=96b2bf0d-df05-4d7e-9018-0b09e1dfa748 fwd="197.210.37.211" dyno= connect= service= status=503 bytes= protocol=https
Not sure about Heroku, but for App Engine does changing the port to 8080 work?
For example:
const server = app.listen(8080, () => {
const host = server.address().address;
const port = server.address().port;
console.log(`Example app listening at http://${host}:${port}`);
});
From Run Express.js on Google App Engine Flexible Environment

Resources