Closed fromage9747 closed 1 week ago
Just had this error get spat out in my console from one of the sites its supposed to be tracking
Uncaught (in promise) Error: Extension context invalidated.
at wakatimeScript.js:1:371252
at wakatimeScript.js:1:371211
I see "Cross-Origin Request Blocked" in the logs. I believe that https://github.com/wakatime/browser-wakatime/commit/88cd9943074d468359de98c551c6f964b0469191 caused the issue. That commit removed <all_urls>
from permissions
. <all_urls>
was valid in manifest v2, but is now moved to host_permissions
in manifest v3. So it is invalid as said in the commit on Chrome, but not on Firefox, which is still using manifest v2. Now on Firefox, the extension does not have permission to send cross-origin requests to the WakaTime server.
However, adding back <all_urls>
would pose potential security risks. It would be better to only declare permissions for the WakaTime server. But in order to support custom servers, it should request permissions during runtime when the user sets the API URL in the settings.
By the way, I think we can use manifest v3 for Firefox to be consistent with Chrome.
By the way, I think we can use manifest v3 for Firefox to be consistent with Chrome.
@ouuan Is there any workaround to get this working for now? Surely I'm not the only one experiencing this issue?
@ouuan Is there any workaround to get this working for now? Surely I'm not the only one experiencing this issue?
First, I want to make sure whether you are using the official WakaTime server (https://api.wakatime.com/) and whether you are using Chrome or Firefox. According to your screenshot, it seems that you are using Chrome. However, based on my experiments, the CORS request failure only happens for Firefox and custom WakaTime servers.
For further troubleshooting:
chrome://inspect/#service-workers
and click "inspect" of jnbbnacmeggbgdjgaoojpmhdlkkpblgi
. See the logs there.@ouuan Thank you for getting back to me.
Is there anything else I can look at to find the issue?
3. Permissions Read and change all your data on all websites
What about the "Site Access" under "Permissions"? You can change the permissions there.
5. If I click on just the service worker there is nothing, it is blank:
Also check the Network tab. Switch between tabs and go back to the service worker inspector to see if heartbeats are sent.
I have this:
Can't find anything regarding Site Access under: chrome://settings/content/siteDetails?site=chrome-extension://jnbbnacmeggbgdjgaoojpmhdlkkpblgi
Checking the network tab whilst flipping through a few sites I get the below:
This is all being performed whilst using Chrome on Windows. I thought I should give it a try using Chrome on Mac and its the same result.
I also tried using Chrome in Incognito mode with only the Wakatime extension enabled to remove any doubt of a conflicting extension, and it's the same outcome.
Try clicking the extension icon. It should send requests to the WakaTime server to get and display the stats if working normally:
This always shows me my current time from when I work and track time through VSCode. And when I inspect the extension and then click on the icon I get the same network result as per my previous screenshot.
When I reinstalled the extension, I also removed all of my included sites and tested with one site to track thinking that maybe one of my configured sites was causing an issue but even with just using once site, no tracking came through. I tried with a few sites individually to get a good sample set of tests and none of them worked.
Investigating a bit further, in the previous version when it did work. When you added a new site you needed to add "@@" after the URL to track so that it came up in Wakatime under the category/name you wanted. I just checked now, and the example provided no longer includes the "@@" perhaps this is my problem?
@ouuan Alright, it's tracking it now, but it's not logging it under the correct Project. Now that the "@@" functionality has been removed... I see that I have to add it under projects in order to get it to correctly log under the right project as it was logging it under a completely irrelevant project name.
Looks like there was no issue with the extension, just configuration changes that I was unaware of after the most recent update.
I just double-checked the GitHub page and there isn't any reference to this configuration.
Anyway, glad its working now.
Thanks for the help.
Fine, so we are encountering different issues. Glad to see yours is now resolved. I think you can close this issue as this thread is now off-topic for my issue on Firefox.
Good luck!
Ever since the most recent update to the extension, it has stopped tracking time. I have tried removing it and configuring it all again, but the result is the same.
Are there any logs that I can look at to see why nothing is being logged? It worked well for months.