-
Notifications
You must be signed in to change notification settings - Fork 448
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
I'm using Partytown for a couple scripts. For proxying, I setup a reverse proxy, copied the example config, and changed the config url to my proxy.
When I check the devtools network tab, I see hundreds of requests per second to proxytown, and it never stops

Reproduction
https://americor-apply.b-cdn.net/
Steps to reproduce
Here is my generated Partytown snippet:
<script
data-ecstatic-ignore>!function (r, o, i, a) { (window.crossOriginIsolated || navigator.serviceWorker) && ((a = r[o] = Object.assign(r[o] || {}, { resolveUrl: 'function (url, location, type) {\n if (type === "script") {\n var proxyUrl = new URL("https://reverse-proxy-rhx1u.bunny.run/");\n proxyUrl.searchParams.append("url", url.href);\n return proxyUrl;\n }\n return url;\n }' }))[i] = (a[i] || []).concat(["dataLayer.push"])) }(window, "partytown", "forward"); let t = { preserveBehavior: !1 }, e = r => { if ("string" == typeof r) return [r, t]; let [o, i = t] = r; return [o, { ...t, ...i }] }, n = Object.freeze((r => { let o = new Set, i = []; do Object.getOwnPropertyNames(i).forEach(r => { "function" == typeof i[r] && o.add(r) }); while ((i = Object.getPrototypeOf(i)) !== Object.prototype) return Array.from(o) })()); !function (r, o, i, a, l, s, c, p, d, u, y = r, f) { function h() { f || (f = 1, "/" == (c = (s.lib || "/~partytown/") + (s.debug ? "debug/" : ""))[0] && (d = o.querySelectorAll('script[type="text/partytown"]'), a != r ? a.dispatchEvent(new CustomEvent("pt1", { detail: r })) : (p = setTimeout(v, (null == s ? void 0 : s.fallbackTimeout) || 1e4), o.addEventListener("pt0", b), l ? w(1) : i.serviceWorker ? i.serviceWorker.register(c + (s.swPath || "partytown-sw.js"), { scope: c }).then(function (r) { r.active ? w() : r.installing && r.installing.addEventListener("statechange", function (r) { "activated" == r.target.state && w() }) }, console.error) : v()))) } function w(i) { u = o.createElement(i ? "script" : "iframe"), r._pttab = Date.now(), i || (u.style.display = "block", u.style.width = "0", u.style.height = "0", u.style.border = "0", u.style.visibility = "hidden", u.setAttribute("aria-hidden", !0)), u.src = c + "partytown-" + (i ? "atomics.js?v=0.11.2" : "sandbox-sw.html?" + r._pttab), o.querySelector(s.sandboxParent || "body").appendChild(u) } function v(i, l) { for (b(), a == r && (s.forward || []).map(function (o) { let [i] = e(o); delete r[i.split(".")[0]] }), i = 0; i < d.length; i++)(l = o.createElement("script")).innerHTML = d[i].innerHTML, l.nonce = s.nonce, o.head.appendChild(l); u && u.parentNode.removeChild(u) } function b() { clearTimeout(p) } s = r.partytown || {}, a == r && (s.forward || []).map(function (o) { let [i, { preserveBehavior: a }] = e(o); y = r, i.split(".").map(function (o, i, l) { var s; y = y[l[i]] = i + 1 < l.length ? y[l[i]] || (s = l[i + 1], n.includes(s) ? [] : {}) : (() => { let o = null; if (a) { let { methodOrProperty: i, thisObject: a } = ((r, o) => { let i = r; for (let r = 0; r < o.length - 1; r += 1)i = i[o[r]]; return { thisObject: i, methodOrProperty: o.length > 0 ? i[o[o.length - 1]] : void 0 } })(r, l); "function" == typeof i && (o = (...r) => i.apply(a, ...r)) } return function () { let i; return o && (i = o(arguments)), (r._ptf = r._ptf || []).push(l, arguments), i } })() }) }), "complete" == o.readyState ? h() : (r.addEventListener("DOMContentLoaded", h), r.addEventListener("load", h)) }(window, document, navigator, top, window.crossOriginIsolated);</script>
Here are the two scripts I'm trying to offload:
<script
type="text/partytown">!function(e,t,a,n,r){e[n]=e[n]||[],e[n].push({"gtm.start":new Date().getTime(),event:"gtm.js"});var g=t.getElementsByTagName(a)[0],m=t.createElement(a);m.async=!0,m.src="https://www.googletagmanager.com/gtm.js?id="+r+("dataLayer"!=n?"&l="+n:""),g.parentNode.insertBefore(m,g)}(window,document,"script","dataLayer","GTM-N8L695QC");</script>
<script
type="text/partytown">!function(){var t=document.createElement("script");t.type="text/javascript",t.async=!0,t.src=("https:"==document.location.protocol?"https":"http")+"://api.trustedform.com/trustedform.js?field=xxTrustedFormCertUrl&ping_field=xxTrustedFormPingUrl&use_tagged_consent=true&l="+new Date().getTime()+Math.random();var e=document.getElementsByTagName("script")[0];e.parentNode.insertBefore(t,e)}();</script>
Browser Info
Chrome
Additional Information
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working