This is the first post. Even if it is too long, I will get tired, so I write it in rough sentences. Please note that it may be difficult to read. This article is based on the article here .
WSL2(Ubuntu-20.04 LTS) Docker Heroku Line-bot-sdk=1.18.0 Flask=1.1.2
As a premise
--Registration of line developers --Install Flask and line-bot-sdk --Register with Heroku --Application registration --Environment variable settings --webhook settings --Creating a configuration file
I would like to proceed as if it is over.
# git add .
# git commit -am "make it better"
# git push heroku main
# heroku open
▸ Error opening web browser.
▸ Error: Exited with code 3
▸
▸ Manually visit https: // your application name.herokuapp.com/ in your browser.
When I opened "https: // your application name.herokuapp.com/" in chrome, an application error occurred on the screen below.
Try heroku logs --tail! It is said that it will be confirmed.
# heroku logs --tail
2020-12-22T11:49:11.712077+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET
path = "/" host = your application name.herokuapp.com ... 2020-12-22T11:49:12.443226+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET p ath = "/ favicon.ico" host = your application name.herokuapp.com ...
Code = H14, status = 503, so consider countermeasures. I searched online and found the following method.
# heroku ps:scale web=1
Restart Heroku
# heroku restart --app application_name
# heroku stack:set container
There was a method such as, but it failed. After that, the result of various investigations.
# cd `your-app-dir`
echo "web: $(basename `pwd`)" > Procfile
As a result of doing, the error statement changed. Apparently, it was a misspelling of "Procfile" as "Profile": sweat_smile :. The error statement after changing the Procfile is as follows.
2020-12-22T12: 38: 17.494371 + 00: 00 heroku [router]: at = error code = H10 desc = "App crashed" method = GET path = "/" host = Anna Application name.herokuapp.com ... 2020-12-22T12: 38: 18.016959 + 00: 00 heroku [router]: at = error code = H10 desc = "App crashed" method = GET path = "/" host = Ah Your application name.herokuapp.com ... 2020-12-22T12:38:18.602766+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path = "/ favicon.ico" host = your application name.herokuapp.com ...
Since Code = H10, status = 503, I tried methods 1 and 2 again, but failed. Trial and error for several hours ... When I was looking at main.py, the cause was found.
The cause was a misspelling in an environment variable: joy :. 「SECRET」→「SELECT」
$ heroku config: set YOUR_CHANNEL_SELECT = "Channel Secret string" --app Your application name
$ heroku config: set YOUR_CHANNEL_SECRET = "Channel Secret string" --app Your application name
It turned out that the environment variable was wrong, so I corrected the relevant part of the code in main.py to "SECRET" and From Heroku.com The problem was solved by manually resetting the environment variables in Applications-> Settings-> Config Vars.
Safely, "Hello World" was displayed on the browser.
https://qiita.com/shimajiri/items/cf7ccf69d184fdb2fb26 https://qiita.com/yagi_eng/items/9308b680e6ee41ab1d6d
Recommended Posts