BuilderIO / partytown

Relocate resource intensive third-party scripts off of the main thread and into a web worker. 🎉
https://partytown.builder.io
MIT License
12.97k stars 427 forks source link

TypeError: load failed #365

Open vilmarfonseca opened 1 year ago

vilmarfonseca commented 1 year ago

We have a website using NextJS with the latest version of Partytown (0.7.5). On our prod version, we're getting the following error on the console:

[Error] TypeError: Load failed

(anonymous function) (df4c7013-a571-4e0f-bc25-8f8de9f92972:2:20624)
asyncFunctionResume
(anonymous function)
promiseReactionJobWithoutPromise
promiseReactionJob

Tracing it back to the file throwing the issue, it's the Partytown script, specifically this try/catch:

try {
    if (o = xe(c, o, "script") + "", F(i, 4, o), t = await fetch(o), t.ok) {
        let e = t.headers.get("content-type");
        $.some((t => {
                var r,
                    n,
                    i;
                return null === (i = null === (r = null == e ? void 0 : e.toLowerCase) || void 0 === r ? void 0 : (n = r.call(e)).includes) || void 0 === i ? void 0 : i.call(n, t)
            })) && (s = await t.text(), c.l = n, Me(c, s, a || o)),
            Ee(i, "load")
    } else
        l = t.statusText,
        Ee(i, "error")
} catch (e) {
    console.error(e),
        l = String(e.stack || e),
        Ee(i, "error")
}

The majority of our reports of this error happen with Safari when using IOS devices with version 16 or higher.

atiabjobayer commented 6 months ago

Facing the same issue. Any fix?