wakatime/wakatime-cli

Wakatime Doesnt work on github codespaces, config file missing

Ishannaik opened this issue · 10 comments

Environment:

  • OS: Codespaces (linux?)
  • Platform:

image
there is no config file present for spaces and popup repeatedly comes up to enter api key
image

Codespaces runs in a cloud server environment. Did you open a terminal and check for the config file at /home/codespaces/.wakatime.cfg? I just tested and it's working for me in github codespaces.

Codespaces runs in a cloud server environment. Did you open a terminal and check for the config file at /home/codespaces/.wakatime.cfg? I just tested and it's working for me in github codespaces.

Yup a config file exists there and after opening it, it does indeed have the api key I pasted when I opened it on VSCode, I have also noticed Every time I start the Codespace or vscode I am asked for the API key again
image

What's the contents of /home/codespaces/.wakatime/wakatime.log

Launching codespaces always gives me this popup
image
Getting the error
image

API Key not found. /home/codespaces/.wakatime/wakatime.log
image

I have double checked grabbing the Secret API Key: from https://wakatime.com/settings/account

.wakatime.cfg
image

Please add this line at the end of your .wakatime.cfg file:
debug = true

Then after a while check your /home/codespaces/.wakatime/wakatime.log file to see if it's looking in the wrong location for the api key, or if there's another reason it couldn't read the api key.

{"caller":"cmd/offline/offline.go:63","func":"offline.loadParams","level":"warning","message":"failed to load API parameters: api key not found or empty","now":"2024-03-20T05:03:06Z","os/arch":"linux/amd64","version":>
{"caller":"cmd/run.go:58","func":"cmd.Run","level":"error","message":"failed to parse config files: failed to load configuration file: error parsing config file: While parsing config: key-value delimiter not found: .w>
{"caller":"cmd/offline/offline.go:63","func":"offline.loadParams","level":"warning","message":"failed to load API parameters: api key not found or empty","now":"2024-03-20T05:03:07Z","os/arch":"linux/amd64","version":>
{"caller":"cmd/run.go:58","func":"cmd.Run","level":"error","message":"failed to parse config files: failed to load configuration file: error parsing config file: While parsing config: key-value delimiter not found: .w>
{"caller":"cmd/run.go:58","func":"cmd.Run","level":"error","message":"failed to parse config files: failed to load configuration file: error parsing config file: While parsing config: key-value delimiter not found: .w>
{"caller":"cmd/run.go:58","func":"cmd.Run","level":"error","message":"failed to parse config files: failed to load configuration file: error parsing config file: While parsing config: key-value delimiter not found: .w>
{"caller":"cmd/offline/offline.go:63","func":"offline.loadParams","level":"warning","message":"failed to load API parameters: api key not found or empty","now":"2024-03-21T02:34:49Z","os/arch":"linux/amd64","version":>

this is being spammed in the logs after adding debug = true

Looks like your /home/codespaces/.wakatime.cfg file is corrupted somehow? At least that's what this error means:

error parsing config file: While parsing config: key-value delimiter not found

Try deleting your /home/codespaces/.wakatime.cfg file then reload the window and re-enter the api key.

Still having the same issue, I've tried different repos as well as creating new codespaces too
The plugin works perfectly fine in Native VSCode, I'm just having issues with the codespace, I've tried opening the codespace in the browser aswell as the open in VSCode option, both are giving me the error somehow

I'm not able to reproduce this on a GitHub codespace opened in the browser. When the codespace first launches and VSCode in the browser opens, I'm prompted to enter my WakaTime API Key. After entering the key, it saves the key correctly to /home/codespaces/.wakatime.cfg and never asks for it again. I verified stopping the codespace then restarting and reopening it also doesn't prompt and correctly uses the saved key from the config file.
Screenshot 2024-03-23 at 8 53 59 AM

We have too many issues open for this. Let's continue debugging in wakatime/vscode-wakatime#362.