legacy-python-cli icon indicating copy to clipboard operation
legacy-python-cli copied to clipboard

VS Code connection error

Open just-Bri opened this issue 5 years ago • 13 comments

[WakaTime][ERROR] ConnectionError: HTTPSConnectionPool(host='api.wakatime.com', port=443): Max retries exceeded with url: /api/v1/users/current/summaries?start=today&end=today (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x000001BE1AC56EB8>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond',)) This is from the VS Code dev tools console.

just-Bri avatar Sep 17 '19 13:09 just-Bri

Just to add, I have confirmed my API key is correct and tried reinstalling wakatime and VS Code.

just-Bri avatar Sep 19 '19 13:09 just-Bri

Unfortunately I have the same error for terminal and Code with: Version: 2.2.1 CLI Version: 13.0.1

Alo, in VSCode error console I get this: Error: tunneling socket could not be established, cause=connect ECONNREFUSED 127.0.0.1:8080

Some advice?

phonnz avatar Dec 03 '19 04:12 phonnz

The 127.0.0.1:8080 isn't a WakaTime server so that error probably isn't related to WakaTime. @phonnz and @reifnotreef, can you check if:

  1. Does today's coding time show in your VS Code status bar?

  2. Does this error occur constantly, or only sometimes?

alanhamlett avatar Dec 03 '19 06:12 alanhamlett

Seems like some problem with python. I uninstalled wakatime plugin from pip for terminal, and cloned the repo, and reinstalled with pip, and I get this error

{"now": "2019/12/03 03:33:31 +0000", "version": "13.0.2", "plugin": "wakatime-zsh-plugin/0.2.1", "time": 1575365611.010461, "caller": "/home/phonnz/.local/lib/python2.7/site-packages/wakatime/api.py", "lineno": 125, "is_write": true, "file": "npm", "level": "WARNING", "message": "{'ProxyError': u"HTTPSConnectionPool(host='api.wakatime.com', port=443): Max retries exceeded with url: /api/v1/users/current/heartbeats.bulk (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7ffb39a33ed0>: Failed to establish a new connection: [Errno 111] Connection refused',)))", 'traceback': 'Traceback (most recent call last):\n File "/home/phonnz/.local/lib/python2.7/site-packages/wakatime/api.py", line 111, in send_heartbeats\n verify=ssl_verify)\n File "/home/phonnz/.local/lib/python2.7/site-packages/wakatime/packages/requests/sessions.py", line 555, in post\n return self.request(\'POST\', url, data=data, json=json, **kwargs)\n File "/home/phonnz/.local/lib/python2.7/site-packages/wakatime/packages/requests/sessions.py", line 508, in request\n resp = self.send(prep, **send_kwargs)\n File "/home/phonnz/.local/lib/python2.7/site-packages/wakatime/packages/requests/sessions.py", line 618, in send\n r = adapter.send(request, **kwargs)\n File "/home/phonnz/.local/lib/python2.7/site-packages/wakatime/packages/requests/adapters.py", line 502, in send\n raise ProxyError(e, request=request)\nProxyError: HTTPSConnectionPool(host=\'api.wakatime.com\', port=443): Max retries exceeded with url: /api/v1/users/current/heartbeats.bulk (Caused by ProxyError(\'Cannot connect to proxy.\', NewConnectionError(\'<urllib3.connection.VerifiedHTTPSConnection object at 0x7ffb39a33ed0>: Failed to establish a new connection: [Errno 111] Connection refused\',)))\n'}"}

The "now" value is accurate and I don't have any proxy in the network.

And for VS Code case, the error is:

Error: Command failed: python3 /home/user/.vscode/extensions/wakatime.vscode-wakatime-2.2.1/wakatime-master/wakatime/cli.py

And I see the wakatime-master.zip with size 0 at ~/.vscode/extensions/wakatime.vscode-wakatime-2.2.1

Thnx in advance

phonnz avatar Dec 03 '19 09:12 phonnz

What if you restart Vscode, does that same error appear again after the plugin initializes?

alanhamlett avatar Dec 03 '19 14:12 alanhamlett

I'm having the same trouble, but the wakatime are not logging any errors.

Visual, Sublime, zsh, vim, etc. In that case, keeps initializing until appear a error message.

I change the default binaries of python to python3 and the error continus, but this time keeps initializing and doesn't inform that an error occur on a while until that finally conclude with the error message on VSCode and Sublime.

Note that debug flag is enabled and not logging any error.

lukaswilkeer avatar Dec 10 '19 16:12 lukaswilkeer

What if you restart Vscode, does that same error appear again after the plugin initializes?

The same, I have tried update, reinstall, restart the editor, and I get mainly this error

{'ProxyError': u\"HTTPSConnectionPool(host='api.wakatime.com', port=443): 
    Max retries exceeded with url: /api/v1/users/current/heartbeats.bulk (Caused by ProxyError('Cannot connect to proxy.', 
    NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f63ea5bbf90>: Failed to establish a new connection: [Errno 111] Connection refused',
    )))\", 'traceback': 'Traceback (most recent call last):\\n  File \"/home/phonnz/.local/lib/python2.7/site-packages/wakatime/api.py\", 
    line 111, in send_heartbeats\\n    verify=ssl_verify)\\n  File \"/home/phonnz/.local/lib/python2.7/site-packages/wakatime/packages/requests/sessions.py\", 
    line 557, in post\\n    return self.request(\\'POST\\', url, data=data, json=json, **kwargs)\\n  
    File \"/home/phonnz/.local/lib/python2.7/site-packages/wakatime/packages/requests/sessions.py\", line 508, in request\\n    
    resp = self.send(prep, **send_kwargs)\\n  File \"/home/phonnz/.local/lib/python2.7/site-packages/wakatime/packages/requests/sessions.py\", 
    line 620, in send\\n    r = adapter.send(request, **kwargs)\\n  File \"/home/phonnz/.local/lib/python2.7/site-packages/wakatime/packages/requests/adapters.py\", 
    line 502, in send\\n    raise ProxyError(e, request=request)\\nProxyError: HTTPSConnectionPool(host=\\'api.wakatime.com\\', port=443): 
    Max retries exceeded with url: /api/v1/users/current/heartbeats.bulk (Caused by ProxyError(\\'Cannot connect to proxy.\\', 
    NewConnectionError(\\'<urllib3.connection.VerifiedHTTPSConnection object at 0x7f63ea5bbf90>: Failed to establish a new connection: [Errno 111] Connection refused\\',)))
    \\n'}

phonnz avatar Dec 18 '19 01:12 phonnz

Finally, after lot of tests, also the edition of the api.py and sessions.py files, I found the reason. When I was debugging the chrome extension, I saw an error saying there was a problem with cross-site cookie, something like I had a different cookie of where/to I was making the request, I uninstalled the plugin on zsh, VS code and chrome extension, cleaned the cookies and now everything is working.

So now, the error of https connection refused makes sense, unfornately I didn't copy the error in order to leave it here for the future or to patch it at least in the logs of terminal and Code plugins.

phonnz avatar Dec 18 '19 02:12 phonnz

@phonnz any suggestion to do when no logs are been recorded?

Wakatime CLI and plugins up to date.

lukaswilkeer avatar Dec 18 '19 10:12 lukaswilkeer

@phonnz from your error message it seems related to an invalid or missing proxy setting:

Caused by ProxyError('Cannot connect to proxy.')

alanhamlett avatar Dec 18 '19 16:12 alanhamlett

@phonnz any suggestion to do when no logs are been recorded?

Wakatime CLI and plugins up to date.

Not really because I haven't had that issue, but I would start watching if the file .wakatime.cfg really has set debug=true
and then watch the .wakatime.log file when you execute commands like

python3 ~/.vscode/extensions/wakatime.vscode-wakatime-2.2.1/wakatime-master/wakatime/cli.py 

And then adding more actions like

python3 ~/.vscode/extensions/wakatime.vscode-wakatime-2.2.1/wakatime-master/wakatime/cli.py --file ~/some-file.js

phonnz avatar Dec 18 '19 16:12 phonnz

@lukaswilkeer with debug mode enabled you should have logs both in your vscode console window and wakatime.log file:

  • vscode console
    • logs the wakatime-cli command when starting to send a heartbeat
    • logs all output from wakatime-cli command
  • wakatime.log
    • logs it's arguments when executed in debug mode before sending a heartbeat
    • logs any error messages encountered when sending the heartbeat
    • logs api response for both success and failure after heartbeat sent

alanhamlett avatar Dec 18 '19 16:12 alanhamlett

@alanhamlett to me, uninstaling ad installing the wakatime plugin solved the equation.

lukaswilkeer avatar Dec 20 '19 13:12 lukaswilkeer