wakatime / wakatime-mode

Emacs plugin for automatic time tracking and metrics generated from your programming activity.
https://wakatime.com/emacs
267 stars 41 forks source link

Issues with proxy line in config #73

Closed SophieBosio closed 7 months ago

SophieBosio commented 7 months ago

Hi,

I have a strange issue, where syncrhonisation only happens after I remove the proxy line from my config, then put it back. The issue returns every time I reopen my editor.

Usually, I open my editor and check the ~/.wakatime/wakatime.log, it informs me heartbeats cannot be sent due to backoff with proxy:

{"caller":"cmd/run.go:341","file":"[redacted for privacy]","is_write":true,"level":"error","message":"failed to run command: sending heartbeat(s) failed: won't send heartbeat due to backoff with proxy","now":"2023-11-23T16:21:50+01:00","os/arch":"linux/amd64","plugin":"emacs-wakatime/1.0.2","time":1700752910.94,"version":"v1.86.6-alpha.3"}

I have tried many things to resolve this issue, but the only way I have gotten it to work, is to comment out the proxy line from my ~/.wakatime.cfg file, delete ~/.wakatime/wakatime-internal.cfg to prompt reconnection, and then uncomment it again.

When I have the line uncommented, it tells me heartbeats cannot be sent due to backoff without proxy, which is not so surprising:

{"caller":"cmd/run.go:341","file":"/home/sophie/.wakatime.cfg","func":"cmd.runCmd","is_write":true,"level":"error","message":"failed to run command: sending heartbeat(s) failed: won't send heartbeat due to backoff without proxy","now":"2023-11-23T16:24:37+01:00","os/arch":"linux/amd64","plugin":"emacs-wakatime/1.0.2","time":1700753077.69,"version":"v1.86.6-alpha.3"}

But when I uncomment the line again, everything seems to run normally and my metrics sync. However, when I close and reopen my editor, the issue returns.

Here is my ~/.wakatime.cfg config file. There may very well be an issue here due to a mistake I've made, so I'd appreciate any help!

[settings]
debug = true
api_key = [redacted]
api_url = https://api.wakatime.com/api/v1
hide_file_names = true
hide_project_names = false
hide_branch_names = false
hide_project_folder = false
exclude =
    ^COMMIT_EDITMSG$
    ^TAG_EDITMSG$
    ^/var/(?!www/).*
    ^/etc/
include =
    .*
include_only_with_project_file = false
exclude_unknown_project = false
status_bar_enabled = true
status_bar_coding_activity = true
status_bar_hide_categories = false
offline = true
proxy = https://user:pass@localhost:8080
no_ssl_verify = true
timeout = 30
hostname = [redacted]
metrics = true

[projectmap]

[project_api_key]

[git]
submodules_disabled = false
project_from_git_remote = false

[git_submodule_projectmap]
alanhamlett commented 7 months ago

Do you need a proxy to connect to the internet? It looks like you copied the example config, which has an invalid proxy defined as an example.

Try removing all those configs and only use the necessary api_key:

[settings]
api_key = [redacted]
SophieBosio commented 7 months ago

That was indeed the issue. I can't believe I commented/uncommented that line so many times without realising I hadn't changed the proxy itself... Thank you for the quick response and for the help!