Port Binding -- what am I doing wrong?

In my python code I’ve got this code going trying to run socket mode with slack bolt.

if name == “main”:
from threading import Thread

def run_slack_app():
    SocketModeHandler(app, os.environ["SLACK_APP_TOKEN"]).start()

Thread(target=run_slack_app).start()
flask_app.run(host='0.0.0.0', port=int(os.environ.get("PORT", 3000)))

However everytime I deploy I get this message:

==> All detected ports bound to 10.204.204.252, localhost instead of 0.0.0.0, continuing to scan for open ports…

==> See the docs on specifying a port: Web Services | Render Docs

What am I doing wrong? Thanks a lot.

Hi,

Your code snippet references Slacks Socket Mode, which notes:

Socket Mode allows your app to use the Events API and interactive features—without exposing a public HTTP Request URL.

So it looks like you’re actually trying to deploy a bot that doesn’t have/need a public-facing URL.

That would point to using a Background Worker if you follow the Which service type is right for my app? flowchart in the docs.

Alan

wow, incredible. Thank you.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.