mujx / hakatime

Wakatime server implementation & analytics dashboard
https://hakatime.mtx-dev.xyz
The Unlicense
631 stars 47 forks source link

cursorpos is not being parsed correctly #11

Closed grantstephens closed 4 years ago

grantstephens commented 4 years ago

Hi- thanks for this awesome project. I am using the sublime text addon which works fine with wakatime, but when making the same request to hakatime I get the following error:

Error in $[0].cursorpos: parsing Int64 failed, expected Number, but encountered String

The request is made in sublime using the wakatime python client and looks something like this:

python3 /home/user/config/.config/sublime-text-3/Packages/WakaTime/packages/wakatime/cli.py --entity /home/user/.config/sublime-text-3/Packages/WakaTime/packages/wakatime/__init__.py --time 1601360222.829188 --plugin "sublime/3211 sublime-wakatime/9.1.2" --key my-api-key --alternate-project WakaTime --cursorpos 97 --verbose --extra-heartbeats

The the log on hakatime says:


10.147.17.8 - - [29/Sep/2020:06:44:48 +0000] "POST /api/v1/users/current/heartbeats.bulk HTTP/1.1" 400 - "" "wakatime/13.0.7 (Linux-5.7.19-2-MANJARO-x86_64-with-arch-Manjaro-Linux) Python3.7.3.final.0 sublime/3211 sublime-wakatime/9.1.2"

And the log in from the wakatime client says:

{"now": "2020/09/29 07:44:48 +0100", "version": "13.0.7", "plugin": "sublime/3211 sublime-wakatime/9.1.2", "time": 1601361857.679305, "caller": "/home/user/config/.config/sublime-text-3/Packages/WakaTime/packages/wakatime/api.py", "lineno": 324, "file": "/home/user/config/.config/sublime-text-3/Packages/WakaTime/packages/wakatime/arguments.py", "level": "ERROR", "message": "{'response_code': 400, 'response_content': 'Error in $[0].cursorpos: parsing Int64 failed, expected Number, but encountered String'}"
mujx commented 4 years ago

Thanks for the bug report. It seems like an inconsistency on the type.

I've only been using the vim plugin which doesn't send the cursorpos and never stumbled upon it

grantstephens commented 4 years ago

Thanks @mujx- working perfectly now