Q
Q
Qnemes2019-12-16 03:16:23
Python
Qnemes, 2019-12-16 03:16:23

Heroku - Python script crashes after deployment, error H10, how to solve?

The error itself is in the logs:

Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
Stopping process with SIGKILL
Process exited with status 137

Procfile:
web: python VKBot.py
requirements.txt:
certifi==2019.11.28
chardet==3.0.4
idna==2.8
numpy==1.17.4
requests==2.22.0
six==1.13.0
urllib3==1.25.7
vk-api==11.6.1

The script itself (everything works locally):
import requests
    import vk_api

    vk_session = vk_api.VkApi(token='mytoken')

    from vk_api.longpoll import VkLongPoll, VkEventType
    longpoll = VkLongPoll(vk_session)
    vk = vk_session.get_api()
    for event in longpoll.listen():
        if event.type == VkEventType.MESSAGE_NEW and event.to_me and event.text:
          if event.text == 'text' or event.text == 'ortext':
                if event.from_user: 
                    vk.messages.send( 
                        user_id=event.user_id,
                        message='mytext'
            )
                elif event.from_chat:
                    vk.messages.send( 
                        chat_id=event.chat_id,
                        message='text'
            )

runtime.txt
python-3.8.0

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question