wakatime / wakatime-cli

Command line interface used by all WakaTime text editor plugins
https://wakatime.com/plugins
BSD 3-Clause "New" or "Revised" License
292 stars 41 forks source link

WakaTime plugin initialized on PhpStorm 2021.3.2 but not syncing or updating stats on dashboard #688

Closed ikunyemingor closed 2 years ago

ikunyemingor commented 2 years ago

Hi,

I noticed the below error after installing WakaTime 13.1.13 on PhpStorm 2021.3.2. It displays **_✔️ Initialized_** at the bottom-right of PhpStorm but doesn't sync when I check the Plugin Status / Stats on https://wakatime.com/plugins/status?onboarding=true.

My dev environment is:

java.lang.Throwable: Assertion failed: assert !app.isDispatchThread()
    at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:218)
    at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.<init>(ActionManagerImpl.java:140)
    at com.jetbrains.rdserver.ui.actionPopupMenu.BackendActionManager.<init>(BackendActionManager.kt:16)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
    at com.intellij.serviceContainer.ConstructorInjectionKt.instantiateUsingPicoContainer(constructorInjection.kt:47)
    at com.intellij.serviceContainer.ComponentManagerImpl.instantiateClassWithConstructorInjection(ComponentManagerImpl.kt:876)
    at com.intellij.serviceContainer.ServiceComponentAdapter.createAndInitialize(ServiceComponentAdapter.kt:47)
    at com.intellij.serviceContainer.ServiceComponentAdapter.doCreateInstance(ServiceComponentAdapter.kt:37)
    at com.intellij.serviceContainer.BaseComponentAdapter.getInstanceUncached(BaseComponentAdapter.kt:113)
    at com.intellij.serviceContainer.BaseComponentAdapter.getInstance(BaseComponentAdapter.kt:67)
    at com.intellij.serviceContainer.BaseComponentAdapter.getInstance$default(BaseComponentAdapter.kt:60)
    at com.intellij.serviceContainer.ComponentManagerImpl.doGetService(ComponentManagerImpl.kt:595)
    at com.intellij.serviceContainer.ComponentManagerImpl.getService(ComponentManagerImpl.kt:569)
    at com.intellij.openapi.client.ClientAwareComponentManager.getFromSelfOrCurrentSession(ClientAwareComponentManager.kt:37)
    at com.intellij.openapi.client.ClientAwareComponentManager.getService(ClientAwareComponentManager.kt:22)
    at com.intellij.openapi.actionSystem.ActionManager.getInstance(ActionManager.java:30)
    at com.intellij.openapi.actionSystem.DefaultActionGroup.addAction(DefaultActionGroup.java:168)
    at com.intellij.openapi.actionSystem.DefaultActionGroup.add(DefaultActionGroup.java:139)
    at com.intellij.ui.mac.touchbar.Touchbar.setButtonActions(Touchbar.java:58)
    at com.intellij.ui.mac.touchbar.Touchbar.setButtonActions(Touchbar.java:49)
    at com.intellij.openapi.ui.DialogWrapper.createSouthPanel(DialogWrapper.java:564)
    at com.intellij.openapi.ui.DialogWrapper.init(DialogWrapper.java:1340)
    at com.wakatime.intellij.plugin.ApiKey.<init>(ApiKey.java:31)
    at com.wakatime.intellij.plugin.WakaTime$2.run(WakaTime.java:135)
    at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:214)
    at com.intellij.openapi.application.TransactionGuardImpl.access$200(TransactionGuardImpl.java:21)
    at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:196)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:805)
    at com.intellij.openapi.application.impl.ApplicationImpl.lambda$invokeLater$4(ApplicationImpl.java:348)
    at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:82)
    at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:131)
    at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:47)
    at com.intellij.openapi.application.impl.FlushQueue$FlushNow.run(FlushQueue.java:187)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:891)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:760)
    at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:447)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:818)
    at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:446)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:805)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:492)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Please can you help?

alanhamlett commented 2 years ago

This is similar to wakatime/jetbrains-wakatime#202. Is there an api key shown when you open Tools -> WakaTime Settings? If not, please enter one and it should start working.

ikunyemingor commented 2 years ago

Yes, there's an API key I added when I installed the plugin. I just clicked save now and it started working

alanhamlett commented 2 years ago

Is debug mode enabled or disabled?

alanhamlett commented 2 years ago

It's working now?

mvarendorff commented 2 years ago

It isn't for me in WebStorm 2021.3.2, Rider 2021.3.3 and Android Studio Bumblebee 2021.1.1 Patch 2, API Key is set, Debug was not checked.

Windows 10 Pro x64

Poking around in various log files, I stumbled over this which seems very much related:

2022-03-05 18:42:18,152 [ 470292]  DEBUG -                       WakaTime - Executing CLI: [C:\Users\redacted\.wakatime\wakatime-cli-windows-amd64.exe, --today, --key, XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX87c2] 
2022-03-05 18:42:18,158 [ 470298]   WARN -                       WakaTime - Cannot run program "C:\Users\redacted\.wakatime\wakatime-cli-windows-amd64.exe": CreateProcess error=5, Access is denied 
java.io.IOException: Cannot run program "C:\Users\redacted\.wakatime\wakatime-cli-windows-amd64.exe": CreateProcess error=5, Access is denied
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
    at java.base/java.lang.Runtime.exec(Runtime.java:592)
    at java.base/java.lang.Runtime.exec(Runtime.java:451)
    at com.wakatime.intellij.plugin.WakaTime$7.run(WakaTime.java:495)
    at com.intellij.util.RunnableCallable.call(RunnableCallable.java:20)
    at com.intellij.util.RunnableCallable.call(RunnableCallable.java:11)
    at com.intellij.openapi.application.impl.ApplicationImpl$1.call(ApplicationImpl.java:271)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
    at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.io.IOException: CreateProcess error=5, Access is denied
    at java.base/java.lang.ProcessImpl.create(Native Method)
    at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:487)
    at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:154)
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
    ... 15 more

Trying to run the file by hand reveals that Windows Defender really doesn't like it:

grafik

The plugins stats page reports CLI 1.38.0 which has release notes mentioning some threat scanning for the windows binary; it seems that went the wrong way?

alanhamlett commented 2 years ago

The plugins stats page reports CLI 1.38.0 which has release notes mentioning some threat scanning for the windows binary; it seems that went the wrong way?

We've been having problems with Defender on every release, so we tried detecting if Defender would block the release in the build pipeline before releasing.

I've just released an update that warns with a popup whenever Defender blocks WakaTime from running.

mvarendorff commented 2 years ago

Ah that makes sense! Thanks so much for the fast response 🚀

alanhamlett commented 2 years ago

Future discussions moved to #660.