0

I created a streamlit app in python and I'm trying to deploy it to Heroku following several youtube videos. However, I keep receiving the following errors and I'm not sure how to correct them.

2020-06-20T14:53:35.863016+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2020-06-20T14:53:35.885669+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-06-20T14:53:35.970864+00:00 heroku[web.1]: Process exited with status 137
2020-06-20T14:53:36.011903+00:00 heroku[web.1]: State changed from starting to crashed
2020-06-20T14:53:36.749597+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=stockinfo-sl.herokuapp.com request_id=9ef454ce-0c45-423b-84ed-c6aa8fbd5a8f fwd="73.181.67.146" dyno= connect= service= status=503 bytes= protocol=https

Here are the following files I have pushed to heroku.

  1. app.py (streamlit app which works on my local machine)

  2. Proc file

    web: sh setup.sh && streamlit run app.py
    
  3. requirements.txt

    pandas==1.0.3
    streamlit==0.61.0
    datetime
    beautifulsoup4==4.9.1
    requests==2.23.0
    
  4. setup.sh

    mkdir -p ~/.streamlit/
    
    echo "\
    [server]\n\
    headless = true\n\
    port = $PORT\n\
    enableCORS = false\n\
    \n\
    " > ~/.streamlit/config.toml
    

I have tried deleting the app and pushing it back onto heroku several times with no luck, also restarting the dynos with no luck. Does anybody see anything wrong with the files I have pushed? Thanks.

prime90
  • 889
  • 2
  • 14
  • 26
  • The first error message is probably key - your web process has to bind to an externally visible port. For example, if you are using Flask, you need `host='0.0.0.0'` in the `run()` argument. See https://stackoverflow.com/questions/36683571/web-process-failed-to-bind-to-port-within-60-seconds-of-launch/36783563#36783563 – bimsapi Aug 19 '20 at 14:08

1 Answers1

3

A web dyno must bind to its assigned $PORT within 60 seconds of startup. If it doesn’t, it is terminated by the dyno manager and a R10 Boot Timeout error is logged.

You need to pass the $PORT to streamlit in your procfile:

web: sh setup.sh && streamlit run --server.port $PORT app.py

Here's documentation that may help: https://devcenter.heroku.com/articles/dynos#web-dynos

bouteillebleu
  • 2,456
  • 23
  • 32
Nayan jain
  • 59
  • 1
  • 8