We've had this weird issue that Matomo broke Partytown since two weeks. We honestly haven't been able to track down the root issue as neither Partytown nor Matomo have been updated recently in the affected logic. However, there is a potential missing null check in worker-anchor.ts:
set(this: any, value) {
let url;
if (anchorProp === 'href') {
if (isValidUrl(value)) {
url = new URL(value);
} else {
const baseHref = env.$location$.href;
url = resolveToUrl(env, baseHref, null);
url.href = new URL(value + '', url.href);
}
} else {
url = resolveToUrl(env, this.href, null);
url[anchorProp] = value;
}
setInstanceStateValue(this, StateProp.url, url.href);
setter(this, ['href'], url.href);
},
Matomo, for whatever reason, sets a.href = http://. This breaks the setter as it tries to invoke url.href = new URL(value + '', url.href); and throws an Error.
We have caught the error just set the href to the baseHref in that case. Not sure it's the most elegant solution, but it works for now. Just wondering whether somebody has run into the same or a similar error with faulty URLs.
We've had this weird issue that Matomo broke Partytown since two weeks. We honestly haven't been able to track down the root issue as neither Partytown nor Matomo have been updated recently in the affected logic. However, there is a potential missing null check in
worker-anchor.ts:Matomo, for whatever reason, sets a.href =
http://. This breaks the setter as it tries to invokeurl.href = new URL(value + '', url.href);and throws an Error.We have caught the error just set the
hrefto thebaseHrefin that case. Not sure it's the most elegant solution, but it works for now. Just wondering whether somebody has run into the same or a similar error with faulty URLs.