wakatime / vscode-wakatime

Visual Studio Code plugin for automatic time tracking and metrics generated from your programming activity.
https://wakatime.com/vs-code
BSD 3-Clause "New" or "Revised" License
1.2k stars 133 forks source link

Working offline (102); #368

Closed VLTHellolin closed 9 months ago

VLTHellolin commented 9 months ago

This problem occurs with VSCode running on WSL2. The Wakatime icon in the bottom status bar displays Working offline... coding activity will sync next time we are online.

Developer Tools:

image

~/.wakatime/wakatime.log

{"caller":"cmd/run.go:116","func":"cmd.Run","level":"debug","message":"command: heartbeat","now":"2023-10-11T13:52:30+08:00","os/arch":"linux/amd64","version":"v1.85.2"}
{"caller":"cmd/heartbeat/heartbeat.go:77","file":"/home/lin/hl-library/README.md","func":"heartbeat.SendHeartbeats","level":"debug","lineno":1,"message":"params: api params: (api key: '<hidden>ebe6', api url: 'https://api.wakatime.com/api/v1', backoff at: '2023-10-11T13:50:49+08:00', backoff retries: 1, hostname: 'Hellolin-Laptop', key patterns: '[]', plugin: 'vscode/1.83.0 vscode-wakatime/24.2.3', proxy url: 'http://127.0.0.1:7890', timeout: 2m0s, disable ssl verify: false, ssl cert filepath: ''), heartbeat params: (category: 'coding', cursor position: '1', entity: '/home/lin/hl-library/README.md', entity type: 'file', num extra heartbeats: 0, is unsaved entity: false, is write: false, language: '', line number: '1', lines in file: '4', time: 1697003550.63395, filter params: (exclude: '[]', exclude unknown project: false, include: '[]', include only with project file: false), project params: (alternate: 'hl-library', branch alternate: '', map patterns: '[]', override: '', git submodules disabled: '[]', git submodule project map: '[]'), sanitize params: (hide branch names: '[]', hide project folder: false, hide file names: '[]', hide project names: '[]', project path override: '/home/lin/hl-library')), offline params: (disabled: false, print max: 10, queue file: '', num sync max: 1000), status bar params: (hide categories: false, output: 'text')","now":"2023-10-11T13:52:30+08:00","os/arch":"linux/amd64","plugin":"vscode/1.83.0 vscode-wakatime/24.2.3","time":1697003550.6339526,"version":"v1.85.2"}
{"caller":"pkg/heartbeat/format.go:18","file":"/home/lin/hl-library/README.md","func":"heartbeat.initHandleOptions","level":"debug","lineno":1,"message":"execute heartbeat filepath formatting","now":"2023-10-11T13:52:30+08:00","os/arch":"linux/amd64","plugin":"vscode/1.83.0 vscode-wakatime/24.2.3","time":1697003550.6339526,"version":"v1.85.2"}
{"caller":"pkg/heartbeat/entity_modify.go:15","file":"/home/lin/hl-library/README.md","func":"heartbeat.initHandleOptions","level":"debug","lineno":1,"message":"execute heartbeat entity modifier","now":"2023-10-11T13:52:30+08:00","os/arch":"linux/amd64","plugin":"vscode/1.83.0 vscode-wakatime/24.2.3","time":1697003550.6339526,"version":"v1.85.2"}
{"caller":"pkg/filter/filter.go:26","file":"/home/lin/hl-library/README.md","func":"heartbeat.initHandleOptions","level":"debug","lineno":1,"message":"execute heartbeat filtering","now":"2023-10-11T13:52:30+08:00","os/arch":"linux/amd64","plugin":"vscode/1.83.0 vscode-wakatime/24.2.3","time":1697003550.6339526,"version":"v1.85.2"}
{"caller":"pkg/remote/remote.go:52","file":"/home/lin/hl-library/README.md","func":"heartbeat.initHandleOptions","level":"debug","lineno":1,"message":"execute remote file detection","now":"2023-10-11T13:52:30+08:00","os/arch":"linux/amd64","plugin":"vscode/1.83.0 vscode-wakatime/24.2.3","time":1697003550.6339526,"version":"v1.85.2"}
{"caller":"pkg/apikey/apikey.go:31","file":"/home/lin/hl-library/README.md","func":"heartbeat.initHandleOptions","level":"debug","lineno":1,"message":"execute api key replacing","now":"2023-10-11T13:52:30+08:00","os/arch":"linux/amd64","plugin":"vscode/1.83.0 vscode-wakatime/24.2.3","time":1697003550.6339526,"version":"v1.85.2"}
{"caller":"pkg/filestats/filestats.go:23","file":"/home/lin/hl-library/README.md","func":"heartbeat.initHandleOptions","level":"debug","lineno":1,"message":"execute filestats detection","now":"2023-10-11T13:52:30+08:00","os/arch":"linux/amd64","plugin":"vscode/1.83.0 vscode-wakatime/24.2.3","time":1697003550.6339526,"version":"v1.85.2"}
{"caller":"pkg/language/language.go:19","file":"/home/lin/hl-library/README.md","func":"heartbeat.initHandleOptions","level":"debug","lineno":1,"message":"execute language detection","now":"2023-10-11T13:52:30+08:00","os/arch":"linux/amd64","plugin":"vscode/1.83.0 vscode-wakatime/24.2.3","time":1697003550.6339526,"version":"v1.85.2"}
{"caller":"pkg/deps/deps.go:38","file":"/home/lin/hl-library/README.md","func":"heartbeat.initHandleOptions","level":"debug","lineno":1,"message":"execute dependency detection","now":"2023-10-11T13:52:30+08:00","os/arch":"linux/amd64","plugin":"vscode/1.83.0 vscode-wakatime/24.2.3","time":1697003550.6339526,"version":"v1.85.2"}
{"caller":"pkg/project/project.go:143","file":"/home/lin/hl-library/README.md","func":"heartbeat.initHandleOptions","level":"debug","lineno":1,"message":"execute project detection for: /home/lin/hl-library/README.md","now":"2023-10-11T13:52:30+08:00","os/arch":"linux/amd64","plugin":"vscode/1.83.0 vscode-wakatime/24.2.3","time":1697003550.6339526,"version":"v1.85.2"}
{"caller":"pkg/project/project.go:243","file":"/home/lin/hl-library/README.md","func":"project.Detect","level":"debug","lineno":1,"message":"execute project-file-detector","now":"2023-10-11T13:52:30+08:00","os/arch":"linux/amd64","plugin":"vscode/1.83.0 vscode-wakatime/24.2.3","time":1697003550.6339526,"version":"v1.85.2"}
{"caller":"pkg/project/project.go:243","file":"/home/lin/hl-library/README.md","func":"project.Detect","level":"debug","lineno":1,"message":"execute project-map-detector","now":"2023-10-11T13:52:30+08:00","os/arch":"linux/amd64","plugin":"vscode/1.83.0 vscode-wakatime/24.2.3","time":1697003550.6339526,"version":"v1.85.2"}
{"caller":"pkg/project/project.go:243","file":"/home/lin/hl-library/README.md","func":"project.Detect","level":"debug","lineno":1,"message":"execute project-file-detector","now":"2023-10-11T13:52:30+08:00","os/arch":"linux/amd64","plugin":"vscode/1.83.0 vscode-wakatime/24.2.3","time":1697003550.6339526,"version":"v1.85.2"}
{"caller":"pkg/project/project.go:243","file":"/home/lin/hl-library/README.md","func":"project.Detect","level":"debug","lineno":1,"message":"execute project-map-detector","now":"2023-10-11T13:52:30+08:00","os/arch":"linux/amd64","plugin":"vscode/1.83.0 vscode-wakatime/24.2.3","time":1697003550.6339526,"version":"v1.85.2"}
{"caller":"pkg/project/project.go:290","file":"/home/lin/hl-library/README.md","func":"project.DetectWithRevControl","level":"debug","lineno":1,"message":"execute git-detector","now":"2023-10-11T13:52:30+08:00","os/arch":"linux/amd64","plugin":"vscode/1.83.0 vscode-wakatime/24.2.3","time":1697003550.6339526,"version":"v1.85.2"}
{"caller":"pkg/project/filter.go:23","file":"/home/lin/hl-library/README.md","func":"heartbeat.initHandleOptions","level":"debug","lineno":1,"message":"execute project filtering","now":"2023-10-11T13:52:30+08:00","os/arch":"linux/amd64","plugin":"vscode/1.83.0 vscode-wakatime/24.2.3","time":1697003550.6339526,"version":"v1.85.2"}
{"caller":"pkg/heartbeat/sanitize.go:30","file":"/home/lin/hl-library/README.md","func":"heartbeat.initHandleOptions","level":"debug","lineno":1,"message":"execute heartbeat sanitization","now":"2023-10-11T13:52:30+08:00","os/arch":"linux/amd64","plugin":"vscode/1.83.0 vscode-wakatime/24.2.3","time":1697003550.6339526,"version":"v1.85.2"}
{"caller":"pkg/remote/remote.go:121","file":"/home/lin/hl-library/README.md","func":"heartbeat.initHandleOptions","level":"debug","lineno":1,"message":"execute remote cleanup","now":"2023-10-11T13:52:30+08:00","os/arch":"linux/amd64","plugin":"vscode/1.83.0 vscode-wakatime/24.2.3","time":1697003550.6339526,"version":"v1.85.2"}
{"caller":"pkg/offline/offline.go:55","file":"/home/lin/hl-library/README.md","func":"heartbeat.SendHeartbeats","level":"debug","lineno":1,"message":"execute offline queue with file /home/lin/.wakatime.bdb","now":"2023-10-11T13:52:30+08:00","os/arch":"linux/amd64","plugin":"vscode/1.83.0 vscode-wakatime/24.2.3","time":1697003550.6339526,"version":"v1.85.2"}
{"caller":"pkg/backoff/backoff.go:41","file":"/home/lin/hl-library/README.md","func":"heartbeat.SendHeartbeats","level":"debug","lineno":1,"message":"execute heartbeat backoff algorithm","now":"2023-10-11T13:52:30+08:00","os/arch":"linux/amd64","plugin":"vscode/1.83.0 vscode-wakatime/24.2.3","time":1697003550.6339526,"version":"v1.85.2"}
{"caller":"pkg/backoff/backoff.go:97","file":"/home/lin/hl-library/README.md","func":"backoff.shouldBackoff","level":"debug","lineno":1,"message":"exponential backoff tried 1 times since Oct 11 13:50:49, will retry at Oct 11 13:51:19","now":"2023-10-11T13:52:30+08:00","os/arch":"linux/amd64","plugin":"vscode/1.83.0 vscode-wakatime/24.2.3","time":1697003550.6339526,"version":"v1.85.2"}
{"caller":"pkg/api/heartbeat.go:27","file":"/home/lin/hl-library/README.md","func":"api.(*Client)","level":"debug","lineno":1,"message":"sending 1 heartbeat(s) to api at https://api.wakatime.com/api/v1/users/current/heartbeats.bulk","now":"2023-10-11T13:52:30+08:00","os/arch":"linux/amd64","plugin":"vscode/1.83.0 vscode-wakatime/24.2.3","time":1697003550.6339526,"version":"v1.85.2"}
{"caller":"pkg/api/heartbeat.go:52","file":"/home/lin/hl-library/README.md","func":"api.(*Client)","level":"debug","lineno":1,"message":"heartbeats: [{\"branch\":\"main\",\"category\":\"coding\",\"cursorpos\":1,\"entity\":\"/home/lin/hl-library/README.md\",\"type\":\"file\",\"language\":\"Markdown\",\"lineno\":1,\"lines\":4,\"project\":\"hl-library\",\"project_root_count\":4,\"time\":1697003550.6339526,\"user_agent\":\"wakatime/v1.85.2 (linux-5.15.123.1-microsoft-standard-WSL2-x86_64) go1.21.1 vscode/1.83.0 vscode-wakatime/24.2.3\"}]","now":"2023-10-11T13:52:30+08:00","os/arch":"linux/amd64","plugin":"vscode/1.83.0 vscode-wakatime/24.2.3","time":1697003550.6339526,"version":"v1.85.2"}
{"caller":"pkg/backoff/backoff.go:54","file":"/home/lin/hl-library/README.md","func":"heartbeat.SendHeartbeats","level":"debug","lineno":1,"message":"incrementing backoff due to error","now":"2023-10-11T13:52:30+08:00","os/arch":"linux/amd64","plugin":"vscode/1.83.0 vscode-wakatime/24.2.3","time":1697003550.6339526,"version":"v1.85.2"}
{"caller":"pkg/offline/offline.go:65","file":"/home/lin/hl-library/README.md","func":"heartbeat.SendHeartbeats","level":"debug","lineno":1,"message":"pushing 1 heartbeat(s) to queue due to error","now":"2023-10-11T13:52:30+08:00","os/arch":"linux/amd64","plugin":"vscode/1.83.0 vscode-wakatime/24.2.3","time":1697003550.6339526,"version":"v1.85.2"}
{"caller":"cmd/run.go:310","file":"/home/lin/hl-library/README.md","func":"cmd.runCmd","level":"error","lineno":1,"message":"failed to run command: sending heartbeat(s) failed: failed making request to \"https://api.wakatime.com/api/v1/users/current/heartbeats.bulk\": Post \"https://api.wakatime.com/api/v1/users/current/heartbeats.bulk\": proxyconnect tcp: dial tcp 127.0.0.1:7890: connect: connection refused","now":"2023-10-11T13:52:30+08:00","os/arch":"linux/amd64","plugin":"vscode/1.83.0 vscode-wakatime/24.2.3","time":1697003550.6339526,"version":"v1.85.2"}
{"caller":"cmd/run.go:116","func":"cmd.Run","level":"debug","message":"command: heartbeat","now":"2023-10-11T13:53:29+08:00","os/arch":"linux/amd64","version":"v1.85.2"}
{"caller":"cmd/heartbeat/heartbeat.go:77","file":"cat","func":"heartbeat.SendHeartbeats","is_write":true,"level":"debug","message":"params: api params: (api key: '<hidden>ebe6', api url: 'https://api.wakatime.com/api/v1', backoff at: '2023-10-11T13:52:30+08:00', backoff retries: 2, hostname: 'Hellolin-Laptop', key patterns: '[]', plugin: 'wakatime-zsh-plugin/0.2.2', proxy url: 'http://127.0.0.1:7890', timeout: 5s, disable ssl verify: false, ssl cert filepath: ''), heartbeat params: (category: 'coding', cursor position: '', entity: 'cat', entity type: 'app', num extra heartbeats: 0, is unsaved entity: false, is write: true, language: 'sh', line number: '', lines in file: '', time: 1697003609.54225, filter params: (exclude: '[]', exclude unknown project: false, include: '[]', include only with project file: false), project params: (alternate: '', branch alternate: '', map patterns: '[]', override: 'Terminal', git submodules disabled: '[]', git submodule project map: '[]'), sanitize params: (hide branch names: '[]', hide project folder: false, hide file names: '[]', hide project names: '[]', project path override: '')), offline params: (disabled: false, print max: 10, queue file: '', num sync max: 1000), status bar params: (hide categories: false, output: 'text')","now":"2023-10-11T13:53:29+08:00","os/arch":"linux/amd64","plugin":"wakatime-zsh-plugin/0.2.2","time":1697003609.542253,"version":"v1.85.2"}
gandarez commented 9 months ago

@hellolin-oi are you behind a proxy?

dial tcp [127.0.0.1:7890](http://127.0.0.1:7890/): connect: connection refused
alanhamlett commented 9 months ago

Looks like he has a proxy accidentally set in his ~/.wakatime.cfg file. Try deleting the proxy line from that file.

VLTHellolin commented 9 months ago

Thanks, wakatime can connect normally after deleting proxy.