Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VSCode still requiring an API key although one is set inside .wakatime.cfg #256

Closed
mainrs opened this issue Jan 9, 2022 · 13 comments
Closed

Comments

@mainrs
Copy link

mainrs commented Jan 9, 2022

I'd expect the extension to pick the key from the configuration file automatically without me having to enter it in again.

@alanhamlett
Copy link
Member

It should... the vscode plugin doesn't have any other way to get your api key. Maybe your ~/.wakatime.cfg file was corrupted, or vscode encountered an error when reading it?

@liyuhang1997
Copy link

liyuhang1997 commented Jan 22, 2022

Sometimes it pops up for no reason and I have to re-enter the API Key.

@mainrs
Copy link
Author

mainrs commented Jan 23, 2022

Sometimes it pops up for no reason and I have to re-enter the API Key.

That’s the behavior I do encounter as well. I double checked it the files. I’ve first created the config file. I then installed the extension. And upon first launching vscode with the extension, it prompted me for the key. Even though the key was present in the confit file.

@alanhamlett
Copy link
Member

alanhamlett commented Jan 23, 2022

Please send your ~/.wakatime.log file to support@wakatime.com. What I'm looking for is an error message saying either failed to read in config or invalid api key. That will tell us if it's asking for your api key because it couldn't read the cfg file, or because the API returned an unauthorized response.

You might need to turn on debug mode for the error message to be logged.

Edit: Also, the next time it asks for your api key before entering it can you send the contents of ~/.wakatime.cfg to support@wakatime.com? Maybe the cfg file is getting corrupted somehow.

@liyuhang1997
Copy link

请将您的~/.wakatime.log文件发送至support@wakatime.com。我正在寻找的是一条错误消息,上面写着failed to read in configor invalid api key。这将告诉我们它是否因为无法读取 cfg 文件而请求您的 api 密钥,或者因为 API 返回了未经授权的响应。

您可能需要打开调试模式才能记录错误消息。

编辑:另外,下次它在输入之前询问您的 api 密钥时,您可以将 ~/.wakatime.cfg 的内容发送到support@wakatime.com吗?也许cfg文件以某种方式损坏。

.wakatime.cfg

[internal]
backoff_at      = 2022-01-30T17:18:01+08:00
backoff_retries = 1

@alanhamlett
Copy link
Member

Do you also use Atom with WakaTime? We just fixed a bug in the atom-wakatime plugin that might have been corrupting your ~/.wakatime.cfg file in certain cases. If you delete your ~/.wakatime.cfg file and restart vscode does it start working again?

@mrgnhnt96
Copy link

I am having this issue as well, it is very annoying. If you try to ignore it, it will pop up every time a file is saved, opened, or closed. It forces you to add the key to stop being bothered by it. Sometimes it will last for a few days without asking again, other times it will ask after a couple of hours

@alanhamlett
Copy link
Member

@jeetsdev what's the contents of your ~/.wakatime.cfg file? Please remove your api key before sharing the file.

@jeetsdev
Copy link

jeetsdev commented Feb 2, 2022

@jeetsdev what's the contents of your ~/.wakatime.cfg file? Please remove your api key before sharing the file.

Here it is-

[internal]
backoff_at      = 2022-02-02T09:18:55+05:30
backoff_retries = 1

[settings]
api_key = "my API key"

@alanhamlett
Copy link
Member

That's valid and shouldn't cause the failed to load command parameters: failed to load api params: failed to load api key error. Maybe this is a bug in wakatime-cli instead of vscode.

@kdoroszewicz
Copy link

Yesterday I was encountering the same bug as @mrgnhnt96. I input my key multiple times, disable and enabled wakatime extension (from the command palette) and nothing worked. The extension kept asking me for the api key. Today it's working again with no additional changes on my side 🤷‍♂️

@alanhamlett
Copy link
Member

alanhamlett commented Feb 2, 2022

Can you try with the latest release just now v18.0.5?

If it's still asking for your api key after updating the plugin, please add a comment here with your:

  • OS (Win/Linux/Mac)
  • contents of your ~/.wakatime.cfg file (with api key removed)
  • any error messages seen in your vscode dev console window
  • your full log file at ~/.wakatime.log

@kdoroszewicz
Copy link

Can you try with the latest release just now v18.0.5?

If it's still asking for your api key after updating the plugin, please add a comment here with your:

  • OS (Win/Linux/Mac)
  • contents of your ~/.wakatime.cfg file (with api key removed)
  • any error messages seen in your vscode dev console window
  • your full log file at ~/.wakatime.log

@alanhamlett over the past 5 days it seems to bo working correctly. Not once I was asked for the api token and everything is tracked properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants