Hi. We do JS error logging in our system and recently there are some new error messages that come from the matomo.js tracker.
We get, very few but noticable, error logs: PromiseError/SecurityError: The operation is insecure.
Stacktrace show following line: matomo.js:66:276 - We have 4.1.0 installed.
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0
Unfortunetely i cannot reproduce this error.
Everything is running in https context, we have no insecure source on the pages where this errors happens. Also the domain where it is running is in trusted domains.
This error have been currently logged 3 times - Out of round about 1000 requests with this specific user agent in the last few weeks.
Could you maybe send me a private message with the URL to your site?
I have never seen this error before and the internet claims it happens when you try to set up a non-ssl websocket or a file:/// URL on a HTTPS site.
But Matomo doesn’t use websockets anywhere.
Is this something you can reproduce or just randomly get sent in an error log from users websites (using something like sentry.io)? In the latter case it could be a browser extension modifying the website and breaking something.
Hi, thanks for your answer. Unfortunetely i cannot send you a URL to this site, as it’s an internal site with no public access.
Sure, it’s always possible that the user have installed an extension that do something weird. But in this case, i don’t think to. Firefox in general have some troubles in the last few versions, they introduce errors that are hard to debug.
Here after the opening { bracket : ...(g.serviceWorker.ready)){g.serviceWorker.ready.then...
We have a websocket connection on this sites, but it’s wss already.
As i’ve said, only 0,3% of this requests have logged this error. Maybe it’s some AntiVirus issue that intercept requests.
I would say, we can call this resolved, as i also don’t think that this is a matomo related issue.
It’s just weird that the stacktrace points to matomo.
It tries to communicate with the service worker if one is set up (it is not by default).
Maybe there is some rare Browser setup where this fails (but thinking about this, this code should only work if any serviceworker is set up). Maybe they have a serviceworker set up due to some browser extension and then the code tries to communicate to it, but fails as it is not on the same domain as Matomo and maybe some security feature blocks this.
Ok, i’ve debugged further. It’s indeed the code that you have stated.
When i just open F12 → Console in FF 84.0 and hit navigator.serviceWorker.ready than this error appears.
It doesnt matter on which site you do this, also in this forums the error happens. A running service worker is not required for this error.
I’ve enabled the cookie setting “Clean cookies and site data when exiting Firefox”, as stated here. https://stackoverflow.com/a/63831245/1887622
At the moment where you disable this flag, the error disappears.
What is weird, is that the Matomo tracking code doesn’t try to register a serviceworker, but just communicate with one if the user had set one up. I guess even that is restricted
in this case.
I think the right solution would be to catch the promise and document it for the people who want to use the service worker for offline tracking.