nassir-malik / IOT-ESP8266-Alexa_Skills_Garage_Door

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Heroku Error: Line without CRLF

tlllava opened this issue · comments

app.py will not run as websockets.http.read_message(self.reader) errors out with an Line without CRLF error. This happens on the unmodified code from git and in my code where I am injecting logging to try to figure out what the heck is happening. Even though there are logging messages before calling read_message(), I never see the messages in the log. This is happening imeadiately without my going over to the Alexa test service and sending anything.

`class HttpWSSProtocol(websockets.WebSocketServerProtocol):
rwebsocket = None
rddata = None

logging.debug("Starting HttpWSSProtocol class")

async def handler(self):
    try:
        logging.debug("In HttpWSSProtocol handler")
        logger = logging.getLogger('websocket.server')
        logger.addHandler(logging.StreamHandler())

        request_line, headers = await websockets.http.read_message(self.reader)
        method, path, version = request_line[:-2].decode().split(None, 2)
        # websockets.accept()
    except Exception as e:
        print(e.args)
        self.writer.close()
        self.ws_server.unregister(self)
        logging.error("Exception found in HttpWSSProtocol() 1", e.args)
        raise`

I get the following in the Heroku logs.
2018-01-07T14:22:11.000000+00:00 app[api]: Build started by user myuser
2018-01-07T14:22:25.433354+00:00 app[api]: Deploy dc97c4d2 by user myuser
2018-01-07T14:22:25.433354+00:00 app[api]: Release v21 created by user myuser
2018-01-07T14:22:25.789999+00:00 heroku[web.1]: Restarting
2018-01-07T14:22:25.791203+00:00 heroku[web.1]: State changed from up to starting
2018-01-07T14:22:11.000000+00:00 app[api]: Build succeeded
2018-01-07T14:22:26.554241+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2018-01-07T14:22:26.643454+00:00 heroku[web.1]: Process exited with status 143
2018-01-07T14:22:28.595374+00:00 heroku[web.1]: Starting process with command python app.py
2018-01-07T14:22:32.209222+00:00 heroku[web.1]: State changed from starting to up
2018-01-07T14:22:32.186601+00:00 app[web.1]: Traceback (most recent call last):
2018-01-07T14:22:32.186662+00:00 app[web.1]: File "app.py", line 38, in handler
2018-01-07T14:22:32.185004+00:00 app[web.1]: ('Line without CRLF',)
2018-01-07T14:22:32.185314+00:00 app[web.1]: --- Logging error ---
2018-01-07T14:22:32.186668+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/websockets/http.py", line 83, in read_message
2018-01-07T14:22:32.186664+00:00 app[web.1]: request_line, headers = await websockets.http.read_message(self.reader)
2018-01-07T14:22:32.186669+00:00 app[web.1]: start_line = yield from read_line(stream)
2018-01-07T14:22:32.186673+00:00 app[web.1]: raise ValueError("Line without CRLF")
2018-01-07T14:22:32.186672+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/websockets/http.py", line 107, in read_line
2018-01-07T14:22:32.186718+00:00 app[web.1]: ValueError: Line without CRLF
2018-01-07T14:22:32.186754+00:00 app[web.1]: Traceback (most recent call last):

this code seem from web and does not work