mujx / hakatime

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

Hakatime 400 Error on Sending Heartbeats #49

Closed jimmybrancaccio closed 3 years ago

jimmybrancaccio commented 3 years ago

Hey @mujx, thanks for looking into #48. It however appears there's still issues. I am on VSCode 1.61.0:

Version: 1.61.0
Commit: ee8c7def80afc00dd6e593ef12f37756d8f504ea
Date: 2021-10-07T18:10:20.463Z
Electron: 13.5.1
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Darwin arm64 20.6.0

and Hakatime 1.6.2 but I am still getting errors. From my .wakatime.log file:

{
    "caller": "/Users/runner/work/wakatime-cli/wakatime-cli/cmd/legacy/run.go:199",
    "func": "runCmd",
    "level": "error",
    "message": "failed to run command: today fetch failed: api error: failed fetching today from api: invalid response status from \"https://hakatime.mydomain.com/api/v1/users/current/statusbar/today\". got: 404, want: 200. body: \"File not found\"",
    "now": "2021-10-10T11:41:06-05:00",
    "version": "v1.27.0"
}
{
    "caller": "/Users/runner/work/wakatime-cli/wakatime-cli/cmd/legacy/run.go:199",
    "func": "runCmd",
    "level": "error",
    "message": "failed to run command: sending heartbeat(s) later due to bad request: bad request at \"https://hakatime.mydomain.com/api/v1/users/current/heartbeats.bulk\"",
    "now": "2021-10-10T11:41:13-05:00",
    "version": "v1.27.0"
}
{
    "caller": "/Users/runner/work/wakatime-cli/wakatime-cli/cmd/legacy/run.go:199",
    "func": "runCmd",
    "level": "error",
    "message": "failed to run command: offline sync failed: bad request: bad request at \"https://hakatime.mydomain.com/api/v1/users/current/heartbeats.bulk\"",
    "now": "2021-10-10T11:44:02-05:00",
    "version": "v1.27.0"
}

And logs from my Hakatime container:


192.168.100.1 - - [10/Oct/2021:11:48:21 -0500] "POST /api/v1/users/current/heartbeats.bulk HTTP/1.1" 400 - "" "wakatime/v1.27.0 (darwin-20.6.0-arm64) go1.17.1 vscode/1.61.0 vscode-wakatime/17.1.0",
192.168.100.1 - - [10/Oct/2021:11:48:21 -0500] "POST /api/v1/plugins/errors HTTP/1.1" 400 - "" "wakatime/v1.27.0 (darwin-20.6.0-arm64) go1.17.1 vscode/1.61.0 vscode-wakatime/17.1.0",
192.168.100.1 - - [10/Oct/2021:11:48:48 -0500] "POST /api/v1/users/current/heartbeats.bulk HTTP/1.1" 400 - "" "wakatime/v1.27.0 (darwin-20.6.0-arm64) go1.17.1 vscode/1.61.0 vscode-wakatime/17.1.0",
192.168.100.1 - - [10/Oct/2021:11:48:48 -0500] "POST /api/v1/plugins/errors HTTP/1.1" 400 - "" "wakatime/v1.27.0 (darwin-20.6.0-arm64) go1.17.1 vscode/1.61.0 vscode-wakatime/17.1.0"
mujx commented 3 years ago

@jimmybrancaccio Are you using the latest wakatime plugin? Also can you share the hakatime logs for those requests?

jimmybrancaccio commented 3 years ago

@mujx Looks like it. I have v17.1.0 and the Changelog is showing that is the latest version. Is it working for you (assuming you use VSCode and this extension)?

Screen Shot 2021-10-10 at 16 51 11PM
mujx commented 3 years ago

I'm not familiar with VS Code and on my testing I was using the open-source version where the Wakatime plugin is quite outdated. So I'll have to install the official version and debug this issue.

jimmybrancaccio commented 3 years ago

Ah okay, well if there's anything I can do to assist in troubleshooting this please don't hesitate to let me know!

vladiiancu commented 2 years ago

@jimmybrancaccio any news? I got the same error earlier and was curious about it

mujx commented 2 years ago

@vladiiancu This has been fixed. Do you still have this issue on the latest version?

vladiiancu commented 2 years ago

Yes. I had an older version installed. Updated it today. Added the old token but I get the file not found error. Created a new token just in case, same. Gone through the settings, saw some new? ENV variables, made the updates there as well, but no luck

jimmybrancaccio commented 2 years ago

@jimmybrancaccio any news? I got the same error earlier and was curious about it

As @mujx mentioned this was fixed (7 months ago). I don't have the issue anymore. I would suggest creating a new issue in GitHub (you can reference this one if you'd like), and provide as much information as possible in it.