-2

I followed the steps by uploading my website to Heroku, but I can't open my website. Any idea?

I get this error:

Application Error An error occurred in the application and your page could not be served. Please try again in a few moments.

If you are the application owner, check your logs for details.

My log file is as follow: I am making web-app using streamlit.

2022-03-20T21:06:35.429122+00:00 app[web.1]: sys.exit(main())
2022-03-20T21:06:35.429123+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/click/core.py", line 1128, in __call__
2022-03-20T21:06:35.429362+00:00 app[web.1]: return self.main(*args, **kwargs)
2022-03-20T21:06:35.429378+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/click/core.py", line 1053, in main
2022-03-20T21:06:35.429665+00:00 app[web.1]: rv = self.invoke(ctx)
2022-03-20T21:06:35.429681+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
2022-03-20T21:06:35.430124+00:00 app[web.1]: return _process_result(sub_ctx.command.invoke(sub_ctx))
2022-03-20T21:06:35.430140+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
2022-03-20T21:06:35.430508+00:00 app[web.1]: return ctx.invoke(self.callback, **ctx.params)
2022-03-20T21:06:35.430524+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/click/core.py", line 754, in invoke
2022-03-20T21:06:35.430722+00:00 app[web.1]: return __callback(*args, **kwargs)
2022-03-20T21:06:35.430741+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/streamlit/cli.py", line 172, in main_run
2022-03-20T21:06:35.430824+00:00 app[web.1]: bootstrap.load_config_options(flag_options=kwargs)
2022-03-20T21:06:35.430841+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/streamlit/bootstrap.py", line 318, in load_config_options
2022-03-20T21:06:35.430941+00:00 app[web.1]: config.get_config_options(force_reparse=True, options_from_flags=options_from_flags)
2022-03-20T21:06:35.430950+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/streamlit/config.py", line 1015, in get_config_options
2022-03-20T21:06:35.431141+00:00 app[web.1]: _update_config_with_toml(file_contents, filename)
2022-03-20T21:06:35.431149+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/streamlit/config.py", line 892, in _update_config_with_toml
2022-03-20T21:06:35.431318+00:00 app[web.1]: parsed_config_file = toml.loads(raw_toml)
2022-03-20T21:06:35.431326+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/toml/decoder.py", line 514, in loads
2022-03-20T21:06:35.431451+00:00 app[web.1]: raise TomlDecodeError(str(err), original, pos)
2022-03-20T21:06:35.431490+00:00 app[web.1]: toml.decoder.TomlDecodeError: Duplicate keys! (line 5 column 1 char 56)
2022-03-20T21:06:35.785381+00:00 heroku[web.1]: Process exited with status 1
2022-03-20T21:06:35.850782+00:00 heroku[web.1]: State changed from starting to crashed
2022-03-21T00:28:31.129216+00:00 heroku[web.1]: State changed from crashed to starting
2022-03-21T00:28:43.156736+00:00 heroku[web.1]: Starting process with command `sh setup.sh && streamlit run app.py`
2022-03-21T00:28:45.415578+00:00 app[web.1]: Traceback (most recent call last):
2022-03-21T00:28:45.415593+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/toml/decoder.py", line 511, in loads
2022-03-21T00:28:45.415755+00:00 app[web.1]: ret = decoder.load_line(line, currentlevel, multikey,
2022-03-21T00:28:45.415771+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/toml/decoder.py", line 781, in load_line
2022-03-21T00:28:45.415940+00:00 app[web.1]: raise ValueError("Duplicate keys!")
2022-03-21T00:28:45.415964+00:00 app[web.1]: ValueError: Duplicate keys!
2022-03-21T00:28:45.415966+00:00 app[web.1]:
2022-03-21T00:28:45.415967+00:00 app[web.1]: During handling of the above exception, another exception occurred:
2022-03-21T00:28:45.415967+00:00 app[web.1]:
2022-03-21T00:28:45.415974+00:00 app[web.1]: Traceback (most recent call last):
2022-03-21T00:28:45.415982+00:00 app[web.1]: File "/app/.heroku/python/bin/streamlit", line 8, in <module>
2022-03-21T00:28:45.416041+00:00 app[web.1]: sys.exit(main())
2022-03-21T00:28:45.416049+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/click/core.py", line 1128, in __call__
2022-03-21T00:28:45.416258+00:00 app[web.1]: return self.main(*args, **kwargs)
2022-03-21T00:28:45.416265+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/click/core.py", line 1053, in main
2022-03-21T00:28:45.416458+00:00 app[web.1]: rv = self.invoke(ctx)
2022-03-21T00:28:45.416466+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
2022-03-21T00:28:45.416740+00:00 app[web.1]: return _process_result(sub_ctx.command.invoke(sub_ctx))
2022-03-21T00:28:45.416748+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
2022-03-21T00:28:45.416996+00:00 app[web.1]: return ctx.invoke(self.callback, **ctx.params)
2022-03-21T00:28:45.417003+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/click/core.py", line 754, in invoke
2022-03-21T00:28:45.417150+00:00 app[web.1]: return __callback(*args, **kwargs)
2022-03-21T00:28:45.417157+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/streamlit/cli.py", line 172, in main_run
2022-03-21T00:28:45.417237+00:00 app[web.1]: bootstrap.load_config_options(flag_options=kwargs)
2022-03-21T00:28:45.417244+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/streamlit/bootstrap.py", line 318, in load_config_options
2022-03-21T00:28:45.417345+00:00 app[web.1]: config.get_config_options(force_reparse=True, options_from_flags=options_from_flags)
2022-03-21T00:28:45.417352+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/streamlit/config.py", line 1015, in get_config_options
2022-03-21T00:28:45.417538+00:00 app[web.1]: _update_config_with_toml(file_contents, filename)
2022-03-21T00:28:45.417545+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/streamlit/config.py", line 892, in _update_config_with_toml
2022-03-21T00:28:45.417714+00:00 app[web.1]: parsed_config_file = toml.loads(raw_toml)
2022-03-21T00:28:45.417721+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/toml/decoder.py", line 514, in loads
2022-03-21T00:28:45.417841+00:00 app[web.1]: raise TomlDecodeError(str(err), original, pos)
2022-03-21T00:28:45.417873+00:00 app[web.1]: toml.decoder.TomlDecodeError: Duplicate keys! (line 5 column 1 char 57)
2022-03-21T00:28:45.657969+00:00 heroku[web.1]: Process exited with status 1
2022-03-21T00:28:45.777366+00:00 heroku[web.1]: State changed from starting to crashed
2022-03-21T03:32:01.829035+00:00 heroku[web.1]: State changed from crashed to starting
2022-03-21T03:32:15.213202+00:00 heroku[web.1]: Starting process with command `sh setup.sh && streamlit run app.py`
2022-03-21T03:32:17.782434+00:00 app[web.1]: Traceback (most recent call last):
2022-03-21T03:32:17.782472+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/toml/decoder.py", line 511, in loads
2022-03-21T03:32:17.782661+00:00 app[web.1]: ret = decoder.load_line(line, currentlevel, multikey,
2022-03-21T03:32:17.782684+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/toml/decoder.py", line 781, in load_line
2022-03-21T03:32:17.782907+00:00 app[web.1]: raise ValueError("Duplicate keys!")
2022-03-21T03:32:17.782929+00:00 app[web.1]: ValueError: Duplicate keys!
2022-03-21T03:32:17.782931+00:00 app[web.1]:
2022-03-21T03:32:17.782941+00:00 app[web.1]: During handling of the above exception, another exception occurred:
2022-03-21T03:32:17.782941+00:00 app[web.1]:
2022-03-21T03:32:17.782943+00:00 app[web.1]: Traceback (most recent call last):
2022-03-21T03:32:17.782943+00:00 app[web.1]: File "/app/.heroku/python/bin/streamlit", line 8, in <module>
2022-03-21T03:32:17.783020+00:00 app[web.1]: sys.exit(main())
2022-03-21T03:32:17.783031+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/click/core.py", line 1128, in __call__
2022-03-21T03:32:17.783336+00:00 app[web.1]: return self.main(*args, **kwargs)
2022-03-21T03:32:17.783346+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/click/core.py", line 1053, in main
2022-03-21T03:32:17.783658+00:00 app[web.1]: rv = self.invoke(ctx)
2022-03-21T03:32:17.783674+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
2022-03-21T03:32:17.784110+00:00 app[web.1]: return _process_result(sub_ctx.command.invoke(sub_ctx))
2022-03-21T03:32:17.784141+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
2022-03-21T03:32:17.784592+00:00 app[web.1]: return ctx.invoke(self.callback, **ctx.params)
2022-03-21T03:32:17.784608+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/click/core.py", line 754, in invoke
2022-03-21T03:32:17.784863+00:00 app[web.1]: return __callback(*args, **kwargs)
2022-03-21T03:32:17.784879+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/streamlit/cli.py", line 172, in main_run
2022-03-21T03:32:17.785016+00:00 app[web.1]: bootstrap.load_config_options(flag_options=kwargs)
2022-03-21T03:32:17.785043+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/streamlit/bootstrap.py", line 318, in load_config_options
2022-03-21T03:32:17.785314+00:00 app[web.1]: config.get_config_options(force_reparse=True, options_from_flags=options_from_flags)
2022-03-21T03:32:17.785330+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/streamlit/config.py", line 1015, in get_config_options
2022-03-21T03:32:17.785639+00:00 app[web.1]: _update_config_with_toml(file_contents, filename)
2022-03-21T03:32:17.785654+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/streamlit/config.py", line 892, in _update_config_with_toml
2022-03-21T03:32:17.785934+00:00 app[web.1]: parsed_config_file = toml.loads(raw_toml)
2022-03-21T03:32:17.785950+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/toml/decoder.py", line 514, in loads
2022-03-21T03:32:17.786159+00:00 app[web.1]: raise TomlDecodeError(str(err), original, pos)
2022-03-21T03:32:17.786229+00:00 app[web.1]: toml.decoder.TomlDecodeError: Duplicate keys! (line 5 column 1 char 57)
2022-03-21T03:32:18.238859+00:00 heroku[web.1]: Process exited with status 1
2022-03-21T03:32:18.333723+00:00 heroku[web.1]: State changed from starting to crashed
2022-03-21T04:45:36.745496+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=celebrity-presictor.herokuapp.com request_id=afa6c1c9-677f-4584-ab96-617589ee7bcd fwd="111.119.187.24" dyno= connect= service= status=503 bytes= protocol=https
2022-03-21T04:45:41.151615+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=celebrity- 
    presictor.herokuapp.com request_id=9dc306b5-1f80-4020-8ece-503396dc11d0 
    fwd="111.119.187.24" dyno= connect= service= status=503 bytes= 
    protocol=https 

Setup.sh file: Setup.sh file contain following line of code.

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

Requirements.txt file: In requirements.txt file I add these two requirements.

streamlit
requests

Procfile: I add following line of code in Procfile

web: sh setup.sh && streamlit run app.py
Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Furqan
  • 12
  • 5
  • 1
    Welcome to Stack Overflow. [Please don't post screenshots of text](https://meta.stackoverflow.com/a/285557/354577). They can't be searched or copied, or even consumed by users of adaptive technologies like screen readers. Instead, paste the code as text directly into your question. If you select it and click the `{}` button or Ctrl+K the code block will be indented by four spaces, which will cause it to be rendered as code. – ChrisGPT was on strike Mar 20 '22 at 18:03
  • `TomlDecodeError: Duplicate keys!`—please show us whatever TOML file you are trying to decode. It looks like you are using Streamlit (though we shouldn't have to guess that—please read [ask]), so this likely refers to your `config.toml`. – ChrisGPT was on strike Mar 20 '22 at 18:06
  • kindly now check the question. I have added file – Furqan Mar 21 '22 at 04:30
  • If this gets reopened I'll add a proper answer, but in the meantime: You are including `headless = true` in your `config.toml` twice. Remove one of them. – ChrisGPT was on strike Mar 21 '22 at 11:58
  • yeah i check it by removing **headless = true** but it didn't help. – Furqan Mar 23 '22 at 09:13
  • Did you get a different error message? Assuming so, removing the duplicate key _did_ help :-). – ChrisGPT was on strike Mar 23 '22 at 12:32

1 Answers1

0

The relevant error message is

toml.decoder.TomlDecodeError: Duplicate keys!

Here, you are including headless twice:

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

Remove one of them, commit, and redeploy.

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257