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.23k stars 137 forks source link

It is not working since a while, it shows connecting #268

Closed n-for-all closed 2 years ago

n-for-all commented 2 years ago

After inspecting the logs:

{"caller":"/Users/runner/work/wakatime-cli/wakatime-cli/cmd/run.go:246","func":"runCmd","level":"error","message":"failed to run command: sending heartbeat(s) later due to api error: 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\": dial tcp [2604:a880:4:1d0::2a7:b000]:443: connect: no route to host","now":"2022-02-18T18:06:04+04:00","version":"v1.35.4"}

I tested the URL "https://api.wakatime.com/api/v1/users/current/heartbeats.bulk"in the browser and shows unauthorized

alanhamlett commented 2 years ago

The error is: dial tcp [2604:a880:4:1d0::2a7:b000]:443: connect: no route to host

Do you have a firewall that could be blocking the plugin from connecting out to the api?

It's expected for that url to show unauthorized in your browser, because it only accepts POST requests and requires an api key.

n-for-all commented 2 years ago

I don't have any firewall, i have only avira antivirus which shouldn't be an issue, i guess the issue is from the latest update in macos, are you using python somewhere in the code?

I tested the commad from nodejs script, it worked, i guess the issue is from the extension and not outside, i can try to replace api.wakatime.com with the ip address and check if that works

alanhamlett commented 2 years ago

are you using python somewhere in the code?

Nope, we don't use Python in this extension anymore. The extension does download a Go binary from https://github.com/wakatime/wakatime-cli/releases/tag/v1.38.0 into ~/.wakatime/, which is the program that's generating that no route to host log message.

I tested the commad from nodejs script, it worked

Which command?

i can try to replace api.wakatime.com with the ip address and check if that works

It's already using the correct ip (2604:a880:4:1d0::2a7:b000) for the WakaTime API. That's our ipv6 address, so maybe it's something related to ipv6. Does this url work in your browser: https://[2604:a880:4:1d0::2a7:b000]/api/v1/meta

n-for-all commented 2 years ago

Ok great, so i deleted and resinstalled the extension, and restarted visual studio, the extension intialized, but when i open another or new workspace the extension get stuck at wakatime initializing, inspecting the developer tools, it shows below, not sure if it is related

image

i guess it is fine to be only for 1 workspace, untill possibly the next update you might fix r support multi workspace

thanks for the support

alanhamlett commented 2 years ago

Might be fixed in v18.0.9. It's possible two workspaces (each workspace loads it's own vscode-wakatime) opened at the same time would corrupt wakatime-cli.zip since they both would download that file at the same time. Appending a random string to the filename will prevent that.

After updating can you open multiple workspaces without errors?

n-for-all commented 2 years ago

I updated and restarted, 2 out of 3 workspace loaded, i restarted vscode again only 1 loaded, seems completely random, but reloading the window seems to work and it gets initialized.