wakatime / WakaTime.novaextension

Nova plugin for automatic time tracking and metrics generated from your programming activity.
https://wakatime.com/nova
5 stars 3 forks source link

API error (102) #9

Closed mikebronner closed 3 years ago

mikebronner commented 3 years ago

After installing the latest update from yesterday, I am seeing the following in the Extension Console:

WakaTime[9:01:49.431000] [WakaTime] [WARN] Api eror (102); Check your ~/.wakatime.log file for more details.

The log file contains the following:

{"now": "2021/04/11 08:14:17 -0700", "version": "13.0.7", "plugin": "nova/5.1 nova-wakatime/2.0.1", "time": 1618154057.386793, "caller": "wakatime/dependencies/__init__.py", "lineno": 145, "file": "/Users/mike/Developer/WakaTime.novaextension/Scripts/main.js", "level": "DEBUG", "message": "Parsing dependencies not supported for javascript.JavascriptParser"}
{"now": "2021/04/11 08:14:17 -0700", "version": "13.0.7", "plugin": "nova/5.1 nova-wakatime/2.0.1", "time": 1618154057.386793, "caller": "wakatime/api.py", "lineno": 45, "file": "/Users/mike/Developer/WakaTime.novaextension/Scripts/main.js", "level": "DEBUG", "message": "Sending heartbeats to api at https://api.wakatime.com/api/v1/users/current/heartbeats.bulk"}
{"now": "2021/04/11 08:14:17 -0700", "version": "13.0.7", "plugin": "nova/5.1 nova-wakatime/2.0.1", "time": 1618154057.386793, "caller": "wakatime/api.py", "lineno": 51, "file": "/Users/mike/Developer/WakaTime.novaextension/Scripts/main.js", "level": "DEBUG", "message": "[{'time': 1618154057.386793, 'entity': '/Users/mike/Developer/WakaTime.novaextension/Scripts/main.js', 'type': 'file', 'category': None, 'is_write': False, 'project': 'WakaTime.novaextension', 'branch': 'master', 'language': 'JavaScript', 'dependencies': [], 'lines': 472, 'lineno': None, 'cursorpos': None, 'user_agent': 'wakatime/13.0.7 (macOS-10.16-x86_64-i386-64bit) Python3.8.1.final.0 nova/5.1 nova-wakatime/2.0.1'}]"}
{"now": "2021/04/11 08:14:17 -0700", "version": "13.0.7", "plugin": "nova/5.1 nova-wakatime/2.0.1", "time": 1618154057.386793, "caller": "wakatime/api.py", "lineno": 302, "file": "/Users/mike/Developer/WakaTime.novaextension/Scripts/main.js", "level": "DEBUG", "message": "{'response_code': 202, 'results': [[{'data': {'branch': 'master', 'category': 'coding', 'created_at': '2021-04-11T15:14:17Z', 'cursorpos': None, 'dependencies': [], 'entity': '/Users/mike/Developer/WakaTime.novaextension/Scripts/main.js', 'id': '27a8d9dd-c332-4766-9fac-f5a7a08a4c38', 'is_write': False, 'language': 'JavaScript', 'lineno': None, 'lines': 472, 'machine_name_id': None, 'project': 'WakaTime.novaextension', 'time': 1618154057.386793, 'type': 'file', 'user_agent_id': None, 'user_id': 'ae0799f1-4625-459a-8247-4e956acc2617'}}, 201]]}"}
{"now": "2021/04/11 08:14:23 -0700", "version": "13.0.7", "plugin": "nova/5.1 nova-wakatime/2.0.1", "time": 1618154063.257111, "caller": "wakatime/dependencies/__init__.py", "lineno": 145, "is_write": true, "file": "/Users/mike/Developer/WakaTime.novaextension/Scripts/main.js", "level": "DEBUG", "message": "Parsing dependencies not supported for javascript.JavascriptParser"}
{"now": "2021/04/11 08:14:23 -0700", "version": "13.0.7", "plugin": "nova/5.1 nova-wakatime/2.0.1", "time": 1618154063.257111, "caller": "wakatime/api.py", "lineno": 45, "is_write": true, "file": "/Users/mike/Developer/WakaTime.novaextension/Scripts/main.js", "level": "DEBUG", "message": "Sending heartbeats to api at https://api.wakatime.com/api/v1/users/current/heartbeats.bulk"}
{"now": "2021/04/11 08:14:23 -0700", "version": "13.0.7", "plugin": "nova/5.1 nova-wakatime/2.0.1", "time": 1618154063.257111, "caller": "wakatime/api.py", "lineno": 51, "is_write": true, "file": "/Users/mike/Developer/WakaTime.novaextension/Scripts/main.js", "level": "DEBUG", "message": "[{'time': 1618154063.257111, 'entity': '/Users/mike/Developer/WakaTime.novaextension/Scripts/main.js', 'type': 'file', 'category': None, 'is_write': True, 'project': 'WakaTime.novaextension', 'branch': 'master', 'language': 'JavaScript', 'dependencies': [], 'lines': 472, 'lineno': None, 'cursorpos': None, 'user_agent': 'wakatime/13.0.7 (macOS-10.16-x86_64-i386-64bit) Python3.8.1.final.0 nova/5.1 nova-wakatime/2.0.1'}]"}
{"now": "2021/04/11 08:14:23 -0700", "version": "13.0.7", "plugin": "nova/5.1 nova-wakatime/2.0.1", "time": 1618154063.257111, "caller": "wakatime/api.py", "lineno": 302, "is_write": true, "file": "/Users/mike/Developer/WakaTime.novaextension/Scripts/main.js", "level": "DEBUG", "message": "{'response_code': 202, 'results': [[{'data': {'branch': 'master', 'category': 'coding', 'created_at': '2021-04-11T15:14:23Z', 'cursorpos': None, 'dependencies': [], 'entity': '/Users/mike/Developer/WakaTime.novaextension/Scripts/main.js', 'id': 'bc1bd304-28c3-436d-bfff-1cc0412edc0a', 'is_write': True, 'language': 'JavaScript', 'lineno': None, 'lines': 472, 'machine_name_id': None, 'project': 'WakaTime.novaextension', 'time': 1618154063.257111, 'type': 'file', 'user_agent_id': None, 'user_id': 'ae0799f1-4625-459a-8247-4e956acc2617'}}, 201]]}"}
alanhamlett commented 3 years ago

That's super strange, because the wakatime.log shows two api responses and both returned success status codes 20x.

alanhamlett commented 3 years ago

What if you turn off debug mode?

mikebronner commented 3 years ago

The warning showed up while debug mode is disabled. I am on an M1 Mac, not sure if that could be problematic (it shouldn't, but thought I'd mention it just in case)?

alanhamlett commented 3 years ago

The wakatime-cli exits with status code 102 after saving the heartbeat to your local offline db. We should update the Nova extension to do what the WakaTime VSCode extension does and ignore api errors because they can occur normally when working without internet access:

https://github.com/wakatime/vscode-wakatime/blob/3746261d495161520abea7aac16ad1e92fd2fa66/src/wakatime.ts#L385

alanhamlett commented 3 years ago

Fixed with c077e8c4b56035d80bcc5bc92c2cb9c15ebda30c.