wakatime / jetbrains-wakatime

IntelliJ IDEA, PyCharm, RubyMine, PhpStorm, AppCode, AndroidStudio, Goland, Rider, & WebStorm plugin for quantifying your coding.
https://wakatime.com/intellij-idea
BSD 3-Clause "New" or "Revised" License
1.14k stars 168 forks source link

Error downloading `wakatime-cli` #268

Closed boxsnake closed 11 months ago

boxsnake commented 11 months ago

Trimmed debug logs in idea.log:

2023-10-13 14:29:39,124 [   1188]   INFO - WakaTime - Initializing WakaTime plugin v14.2.3 (https://wakatime.com/)
2023-10-13 14:29:39,155 [   1219]   INFO - WakaTime - Downloading and installing wakatime-cli...
2023-10-14 02:06:07,742 [   2351]   INFO - WakaTime - Initializing WakaTime plugin v14.2.3 (https://wakatime.com/)
2023-10-14 02:06:07,755 [   2364]   FINE - WakaTime - Logging level set to DEBUG
2023-10-14 02:06:07,775 [   2384]   INFO - WakaTime - Downloading and installing wakatime-cli...
2023-10-14 02:06:07,778 [   2387]   FINE - WakaTime - getUrlAsString(https://api.github.com/repos/wakatime/wakatime-cli/releases/latest)
2023-10-14 02:07:25,569 [  80178]   WARN - WakaTime - 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。
2023-10-14 02:07:25,572 [  80181]   FINE - WakaTime - DownloadFile(https://github.com/wakatime/wakatime-cli/releases/download/Unknown/wakatime-cli-windows-amd64.zip)
2023-10-14 02:09:03,311 [ 177920]   WARN - WakaTime - 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。
2023-10-14 02:09:03,313 [ 177922]   INFO - WakaTime - Finished downloading and installing wakatime-cli.
2023-10-14 02:09:03,314 [ 177923]   WARN - WakaTime - C:\Users\boxsn\.wakatime\wakatime-cli-windows-amd64.exe
2023-10-14 02:09:03,314 [ 177923]   FINE - WakaTime - wakatime-cli location: C:\Users\boxsn\.wakatime\wakatime-cli-windows-amd64.exe
2023-10-14 02:09:07,832 [ 182441]   FINE - WakaTime - Executing CLI: [C:\Users\boxsn\.wakatime\wakatime-cli-windows-amd64.exe, --plugin, IDEA/2023.2.2 IDEA-wakatime/14.2.3, --entity, E:/Projects/GitHub/kongying-tavern/genshin-map-cloud/genshin-map-api/genshin-map-api-core/genshin-map-api-core-core/src/main/java/site/yuanshen/genshin/core/controller/CacheController.java, --time, 1697220375.1900, --key, XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXaa5e, --lines-in-file, 77, --alternate-project, genshin-map-cloud, --alternate-language, JAVA, --extra-heartbeats]
2023-10-14 02:09:07,833 [ 182442]   WARN - WakaTime - Cannot run program "C:\Users\boxsn\.wakatime\wakatime-cli-windows-amd64.exe": CreateProcess error=2, 系统找不到指定的文件。
2023-10-14 02:23:07,519 [1022128]   FINE - WakaTime - Executing CLI: [C:\Users\boxsn\.wakatime\wakatime-cli-windows-amd64.exe, --today, --key, XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXaa5e]
2023-10-14 02:23:07,520 [1022129]   WARN - WakaTime - Cannot run program "C:\Users\boxsn\.wakatime\wakatime-cli-windows-amd64.exe": CreateProcess error=2, 系统找不到指定的文件。
2023-10-14 02:23:07,818 [1022427]   FINE - WakaTime - Executing CLI: [C:\Users\boxsn\.wakatime\wakatime-cli-windows-amd64.exe, --plugin, IDEA/2023.2.2 IDEA-wakatime/14.2.3, --entity, E:/Projects/GitHub/kongying-tavern/genshin-map-cloud/genshin-map-api/genshin-map-api-core/genshin-map-api-core-core/src/main/java/site/yuanshen/genshin/core/dao/impl/MarkerDaoImpl.java, --time, 1697221387.5200, --key, XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXaa5e, --lines-in-file, 248, --alternate-project, genshin-map-cloud, --alternate-language, JAVA]
2023-10-14 02:23:07,818 [1022427]   WARN - WakaTime - Cannot run program "C:\Users\boxsn\.wakatime\wakatime-cli-windows-amd64.exe": CreateProcess error=2, 系统找不到指定的文件。

The URL link fetching wakatime-cli in getUrlAsString(https://api.github.com/repos/wakatime/wakatime-cli/releases/latest) will redirect to https://api.github.com/repos/wakatime/wakatime-cli/releases/latest, which gives a 404 in browser:

image

Hence, the wakatime-cli is not downloaded to $WAKATIME_HOME\.wakatime

gandarez commented 11 months ago

Are you in China? It seems to be a temporary problem. I can open https://api.github.com/repos/wakatime/wakatime-cli/releases/latest.

boxsnake commented 11 months ago

@gandarez Yes, I am in china.

I can not access https://github.com/repos/wakatime/wakatime-cli/releases/latest but https://github.com/wakatime/wakatime-cli/releases/latest is available, which redirects to the release page.

gandarez commented 11 months ago

@alanhamlett any thoughts here? We should redirect China users to a different url maybe?

boxsnake commented 11 months ago

https://api.github.com/repos/wakatime/wakatime-cli/releases/latest redirects to https://github.com/repos/wakatime/wakatime-cli/releases/latest, as following: image

However, https://api.github.com/wakatime/wakatime-cli/releases/latest redirects to https://github.com/wakatime/wakatime-cli/releases/tag/v1.85.2, as following: image

I think this should be fetched as a JSON, right? None of these is the correct routine, this is so weird.

boxsnake commented 11 months ago

@gandarez Can you offer a snapshot with how you can access https://api.github.com/repos/wakatime/wakatime-cli/releases/latest?

Thanks.

boxsnake commented 11 months ago

Due to GitHub API Doc, the GH Authorization bearer token is present. I am not sure if this affects.

boxsnake commented 11 months ago

A workaround:

Then everything will "seems" done. The only thing should be notice is that you may spend time to try updating and this updating process will finally fail.

boxsnake commented 11 months ago

Okay, I see.

It seems something wrong with my DNS resolving. It simply convert api.github.com to github.com.

Hmmm...