-
Notifications
You must be signed in to change notification settings - Fork 276
Closed
Labels
Description
I recently switched my bot running in Heroku to the bolt framework but I'm only able to get it working in Socket Mode.
Reproducible in:
--> slack-bolt==1.1.1
--> Python 3.9.0
ProductName: macOS
ProductVersion: 11.2.2
BuildVersion: 20D80
Darwin Kernel Version 20.3.0
Steps to reproduce:
1.) Searched issues for existing issues.
2.) Tried various code changes. One example below:
app = App(
token=SLACK_BOT_TOKEN,
signing_secret=SLACK_SIGNING_SECRET,
verification_token=VERIFICATION_TOKEN
)
flask_app = Flask(__name__)
@flask_app.route("/slack/events", methods=["POST"])
def flask_handler(event):
_handler = SlackRequestHandler(app=app)
return _handler.handle(event)
...
if __name__ == "__main__":
# Only for local debug
SocketModeHandler(app, SLACK_APP_TOKEN).start()
flask_app.run(debug=True, host="0.0.0.0", port=int(os.environ.get("PORT", 3000))). # or flask_app.run(port=os.environ.get('PORT'))
3.) Disabled Socket Mode, reenabled.
4.) Tried different code snippets from Docker/Flask/flask-gunicorn examples directory
Expected result:
The bot to run and accept event requests server-side (via Heroku) and able to run Socket Mode for ongoing local development simultaneously.
Actual result:
Getting 404 and 503 errors (with Socket Mode disabled)
heroku[router]: at=info method=POST path="/" host=bot.herokuapp.com request_id=b2fe742e-412e-419b-a828 fwd="35.170.200.13" dyno=web.1 connect=0ms service=3ms status=404 bytes=400 protocol=https
heroku[router]: at=error code=H12 desc="Request timeout" method=POST path="/slack/events" host=rhc-bot.herokuapp.com request_id=a68ec33d-500f-40f7-a750-f44de4327de4 fwd="3.80.210.39" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0 protocol=https