ba0f3 / telebot.nim

Async Telegram Bot API Client implement in @Nim-Lang
MIT License
165 stars 24 forks source link

Invalid http version #6

Closed facorazza closed 6 years ago

facorazza commented 6 years ago
DEBUG, [21:01:00] Making request to https://api.telegram.org/bot[API_KEY_OMITTED]
/getUpdates
echo.nim(39)             echo
api.nim(268)             poll
asyncdispatch.nim(1507)  waitFor
asyncdispatch.nim(1511)  poll
asyncdispatch.nim(1277)  runOnce
asyncdispatch.nim(183)   processPendingCallbacks
asyncmacro.nim(34)       parseResponse_continue
httpclient.nim(1040)     parseResponseIter
httpclient.nim(226)      httpError
[[reraised from:
echo.nim(39)             echo
api.nim(268)             poll
asyncdispatch.nim(1507)  waitFor
asyncdispatch.nim(1511)  poll
asyncdispatch.nim(1277)  runOnce
asyncdispatch.nim(183)   processPendingCallbacks
asyncmacro.nim(34)       requestAux_continue
asyncmacro.nim           requestAuxIter
asyncfutures.nim(304)    read
]]
[[reraised from:
echo.nim(39)             echo
api.nim(268)             poll
asyncdispatch.nim(1507)  waitFor
asyncdispatch.nim(1511)  poll
asyncdispatch.nim(1277)  runOnce
asyncdispatch.nim(183)   processPendingCallbacks
asyncmacro.nim(34)       post_continue
asyncmacro.nim           postIter
asyncfutures.nim(304)    read
]]
[[reraised from:
echo.nim(39)             echo
api.nim(268)             poll
asyncdispatch.nim(1507)  waitFor
asyncdispatch.nim(1511)  poll
asyncdispatch.nim(1277)  runOnce
asyncdispatch.nim(183)   processPendingCallbacks
asyncmacro.nim(34)       makeRequest_continue
utils.nim(56)            makeRequestIter
asyncfutures.nim(304)    read
]]
[[reraised from:
echo.nim(39)             echo
api.nim(268)             poll
asyncdispatch.nim(1507)  waitFor
asyncdispatch.nim(1511)  poll
asyncdispatch.nim(1277)  runOnce
asyncdispatch.nim(183)   processPendingCallbacks
asyncmacro.nim(34)       getUpdates_continue
api.nim(233)             getUpdatesIter
asyncfutures.nim(304)    read
]]
[[reraised from:
echo.nim(39)             echo
api.nim(268)             poll
asyncdispatch.nim(1649)  waitFor
asyncfutures.nim(304)    read
]]
Error: unhandled exception: invalid http version, 0x10fe26210"<html>"
Async traceback:
  echo.nim(39)            echo
  api.nim(268)            poll
  asyncdispatch.nim(1507) waitFor
  asyncdispatch.nim(1511) poll
    ## Processes asynchronous completion events
  asyncdispatch.nim(1277) runOnce
  asyncdispatch.nim(183)  processPendingCallbacks
    ## Executes pending callbacks
  asyncmacro.nim(34)      parseResponse_continue
    ## Resumes an async procedure
  httpclient.nim(1040)    parseResponseIter
  httpclient.nim(226)     httpError
  #[
    echo.nim(39)            echo
    api.nim(268)            poll
    asyncdispatch.nim(1507) waitFor
    asyncdispatch.nim(1511) poll
      ## Processes asynchronous completion events
    asyncdispatch.nim(1277) runOnce
    asyncdispatch.nim(183)  processPendingCallbacks
      ## Executes pending callbacks
    asyncmacro.nim(34)      requestAux_continue
      ## Resumes an async procedure
    asyncmacro.nim(0)       requestAuxIter
    asyncfutures.nim(304)   read
  ]#
  #[
    echo.nim(39)            echo
    api.nim(268)            poll
    asyncdispatch.nim(1507) waitFor
    asyncdispatch.nim(1511) poll
      ## Processes asynchronous completion events
    asyncdispatch.nim(1277) runOnce
    asyncdispatch.nim(183)  processPendingCallbacks
      ## Executes pending callbacks
    asyncmacro.nim(34)      post_continue
      ## Resumes an async procedure
    asyncmacro.nim(0)       postIter
    asyncfutures.nim(304)   read
  ]#
  #[
    echo.nim(39)            echo
    api.nim(268)            poll
    asyncdispatch.nim(1507) waitFor
    asyncdispatch.nim(1511) poll
      ## Processes asynchronous completion events
    asyncdispatch.nim(1277) runOnce
    asyncdispatch.nim(183)  processPendingCallbacks
      ## Executes pending callbacks
    asyncmacro.nim(34)      makeRequest_continue
      ## Resumes an async procedure
    utils.nim(56)           makeRequestIter
    asyncfutures.nim(304)   read
  ]#
  #[
    echo.nim(39)            echo
    api.nim(268)            poll
    asyncdispatch.nim(1507) waitFor
    asyncdispatch.nim(1511) poll
      ## Processes asynchronous completion events
    asyncdispatch.nim(1277) runOnce
    asyncdispatch.nim(183)  processPendingCallbacks
      ## Executes pending callbacks
    asyncmacro.nim(34)      getUpdates_continue
      ## Resumes an async procedure
    api.nim(233)            getUpdatesIter
    asyncfutures.nim(304)   read
  ]#
Exception message: invalid http version, 0x10fe26210"<html>"
Exception type: [ProtocolError]
ba0f3 commented 6 years ago

do you still using example code in readme?

facorazza commented 6 years ago

I used both the example code in README and the echo example

ba0f3 commented 6 years ago

what is your Nim version, again?

facorazza commented 6 years ago

0.18.0

ba0f3 commented 6 years ago

can you run it w/ latest dev version?

facorazza commented 6 years ago

I compiled it with 0.18.1 but I still get the same error message

ba0f3 commented 6 years ago

ok, I will take a look as soon as I have spare time

ba0f3 commented 6 years ago

I can't reproduce the error, mine is still works fine

facorazza commented 6 years ago

The problem was that in the secret.key file my editor automatically added an empty line and that was causing the error. It works now 👍

ba0f3 commented 6 years ago

glad that it works, I will improve the example code to avoid futher problem

facorazza commented 6 years ago

On that note I think there is an inconsistency in the echo example but I'll open another issue for that