Home > other >  Successful build of Heroku Python App but execution is unsuccessful and open app throws error
Successful build of Heroku Python App but execution is unsuccessful and open app throws error

Time:01-06

I recently successfully deployed a Heroku app(view log below for details), but when I try to access my app through a browser, it returns with An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command heroku logs --tail. Furthermore, my app was for a Discord.Py bot, and the bot was not online like it should be.

Logs:

-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/python
-----> Python app detected
-----> No Python version was specified. Using the same version as the last build: python-3.9.9
       To use a different version, see: https://devcenter.heroku.com/articles/python-runtimes
-----> Requirements file has been changed, clearing cached dependencies
-----> Installing python-3.9.9
-----> Installing pip 21.3.1, setuptools 57.5.0 and wheel 0.37.0
-----> Installing SQLite3
-----> Installing requirements with pip
       Collecting discord.py==1.6.0
         Downloading discord.py-1.6.0-py3-none-any.whl (779 kB)
       Collecting Flask==2.0.2
         Downloading Flask-2.0.2-py3-none-any.whl (95 kB)
       Collecting dnspython==1.16.0
         Downloading dnspython-1.16.0-py2.py3-none-any.whl (188 kB)
       Collecting PyNaCl==1.3.0
         Downloading PyNaCl-1.3.0-cp34-abi3-manylinux1_x86_64.whl (759 kB)
       Collecting async-timeout==3.0.1
         Downloading async_timeout-3.0.1-py3-none-any.whl (8.2 kB)
       Collecting aiohttp<3.8.0,>=3.6.0
         Downloading aiohttp-3.7.4.post0-cp39-cp39-manylinux2014_x86_64.whl (1.4 MB)
       Collecting Jinja2>=3.0
         Downloading Jinja2-3.0.3-py3-none-any.whl (133 kB)
       Collecting itsdangerous>=2.0
         Downloading itsdangerous-2.0.1-py3-none-any.whl (18 kB)
       Collecting Werkzeug>=2.0
         Downloading Werkzeug-2.0.2-py3-none-any.whl (288 kB)
       Collecting click>=7.1.2
         Downloading click-8.0.3-py3-none-any.whl (97 kB)
       Collecting cffi>=1.4.1
         Downloading cffi-1.15.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (444 kB)
       Collecting six
         Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
       Collecting yarl<2.0,>=1.0
         Downloading yarl-1.7.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (304 kB)
       Collecting attrs>=17.3.0
         Downloading attrs-21.4.0-py2.py3-none-any.whl (60 kB)
       Collecting chardet<5.0,>=2.0
         Downloading chardet-4.0.0-py2.py3-none-any.whl (178 kB)
       Collecting typing-extensions>=3.6.5
         Downloading typing_extensions-4.0.1-py3-none-any.whl (22 kB)
       Collecting multidict<7.0,>=4.5
         Downloading multidict-5.2.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (174 kB)
       Collecting pycparser
         Downloading pycparser-2.21-py2.py3-none-any.whl (118 kB)
       Collecting MarkupSafe>=2.0
         Downloading MarkupSafe-2.0.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (30 kB)
       Collecting idna>=2.0
         Downloading idna-3.3-py3-none-any.whl (61 kB)
       Installing collected packages: multidict, idna, yarl, typing-extensions, pycparser, MarkupSafe, chardet, attrs, async-timeout, Werkzeug, six, Jinja2, itsdangerous, click, cffi, aiohttp, PyNaCl, Flask, dnspython, discord.py
       Successfully installed Flask-2.0.2 Jinja2-3.0.3 MarkupSafe-2.0.1 PyNaCl-1.3.0 Werkzeug-2.0.2 aiohttp-3.7.4.post0 async-timeout-3.0.1 attrs-21.4.0 cffi-1.15.0 chardet-4.0.0 click-8.0.3 discord.py-1.6.0 dnspython-1.16.0 idna-3.3 itsdangerous-2.0.1 multidict-5.2.0 pycparser-2.21 six-1.16.0 typing-extensions-4.0.1 yarl-1.7.2
-----> Discovering process types
       Procfile declares types -> worker
-----> Compressing...
       Done: 62M
-----> Launching...
       Released v5
       https://app.herokuapp.com/ deployed to Heroku

CodePudding user response:

Your application is a worker (Procfile declares types -> worker) so it does respond to HTTP requests.

Change to web and make sure you bind the PORT provided by Heroku.

BTW BOTs can run as workers (without dealing with incoming requests) if they poll the server for messages/updates. This is a viable option too (keep it as worker) but ensure the BOT logs what it does at startup.

  •  Tags:  
  • Related