Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

SSL certificate verify failure when trying to run Bolt Python Slack app. (expired certificate)

$
0
0

When trying to run the app to test if the event listener is working properly (python app.py in the terminal), it will output that the Bolt app is running, but then immediately follow up with 'Failure to establish connection (session_id= .....)' and states SSL: CERTIFICATE_VERIFY_FAILED. Here is my code:

import osimport slackimport sslfrom pathlib import Pathfrom dotenv import load_dotenvfrom slack_bolt import Appfrom slack_bolt.adapter.socket_mode import SocketModeHandlerssl._create_default_https_context = ssl._create_unverified_context# Initialize the app and retrieve tokensenv_path = Path('.')/'.env'load_dotenv(dotenv_path=env_path)# client connects to the Slack API and allows use of the SDKclient = slack.WebClient(token=os.environ['SLACK_BOT_TOKEN'])# app allows the bot to listen to events in Slackapp = App(token=os.environ['SLACK_BOT_TOKEN'])@app.message("Are you listening?")def response(message, say): # say sends a message to the channel where the event was triggered    say(f"Yes, <@{message['user']}>")if __name__ == "__main__":    SocketModeHandler(app, os.environ["SLACK_APP_TOKEN"]).start()

When running the app, this is the output:

Failed to establish a connection (session id: 105eefb9-3711-4734-91ad-4b3a0773778e, error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1007))on_error invoked (session id: None, error: SSLCertVerificationError, message: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1007))Bolt app is running!Failed to establish a connection (session id: b0d583f3-fe0c-4d45-ae2c-07609ad8ad8e, error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1007))on_error invoked (session id: 105eefb9-3711-4734-91ad-4b3a0773778e, error: SSLCertVerificationError, message: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1007))

Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>