部分中斷share-external
Facebook SDK config file making call to localhost
13

Since 5th September, our internal JS error tracking has been flagging failed fetch requests to localhost:12387. No changes have been made on our side, and the existing Facebook tracking pixel we use loads via Google Tag Manager.

Specifically, on closer inspection, the config file found at - https://connect.facebook.net/signals/config/ - has this chunk of code within it that tries to make a call to localhost.

(function(a,b,c,d){var e={exports:{}};e.exports;(function(){var f=a.fbq;f.execStart=a.performance&&a.performance.now&&a.performance.now();if(!function(){var b=a.postMessage||function(){};if(!f){b({action:"FB_LOG",logType:"Facebook Pixel Error",logMessage:"Pixel code is not installed correctly on this page"},"*");"error"in console&&console.error("Facebook Pixel Error: Pixel code is not installed correctly on this page");return!1}return!0}())return;f.__fbeventsModules||(f.__fbeventsModules={},f.__fbeventsResolvedModules={},f.getFbeventsModules=function(a){f.__fbeventsResolvedModules[a]||(f.__fbeventsResolvedModules[a]=f.__fbeventsModulesa);return f.__fbeventsResolvedModules[a]},f.fbIsModuleLoaded=function(a){return!!f.__fbeventsModules[a]},f.ensureModuleRegistered=function(b,a){f.fbIsModuleLoaded(b)||(f.__fbeventsModules[b]=a)});

f.ensureModuleRegistered("SignalsFBEvents.plugins.actionid",function(){

return function(a,b,c,d){var e={exports:{}};e.exports;(function(){"use strict";var a=f.getFbeventsModules("SignalsFBEventsPlugin"),b=f.getFbeventsModules("SignalsFBEventsEvents"),c=b.setFBP,d=f.getFbeventsModules("signalsFBEventsGetIsAndroid"),g=f.getFbeventsModules("signalsFBEventsGetIsAndroidIAW");b=f.getFbeventsModules("SignalsFBEventsLogging");var h=b.logError;b=f.getFbeventsModules("SignalsFBEventsLocalStorageUtils");var i=b.getLocalStorageItem,j=b.setLocalStorageItem,k=b.isLocalStorageSupported,l=2,m=0;e.exports=new a(function(a,b){if(g()||!d()||!k())return;c.listen(function(a,c){if(a==null||c==null||c===""||m>=l)return;a=b.pluginConfig.get(a,"actionID");if(a==null)return;var d=a.portNumber;a=a.ttlInHour;var e="aidTime",f=i(e);if(f!=null&&(new Date().getTime()-Number(f))/(1e36060)<a)return;m++;fetch("http://localhost:"+d+"/?aid="+encodeURIComponent(c)).then(function(a){a.ok&&j(e,new Date().getTime())})["catch"](function(a){a.message="[ActionID Error] "+a.message,h(a)})})})})();return e.exports}(a,b,c,d)});e.exports=f.getFbeventsModules("SignalsFBEvents.plugins.actionid");f.registerPlugin&&f.registerPlugin("fbevents.plugins.actionid",e.exports);

f.ensureModuleRegistered("fbevents.plugins.actionid",function(){

return e.exports})})()})(window,document,location,history);

Can anyone advise why a request exists in this file for localhost in production?

Olly
已發問 約 2 個月前
Peter

I'm seeing this too, any word from Facebook about this?

9月22日 20:33
Nuttakit

same here

9月23日 03:09
Olly

No word from Facebook, raised a ticket but have just got arbitrary stuff back so far. Will update if I get to the bottom of it

9月24日 03:19
Daniel

I'm also see this. Thanks in advance, Olly!

9月26日 13:07
Nemrod

Same here...

9月27日 13:20
Olly

This seems to be fixed on my SDK as of 1st October between 19:00 and 20:00 BST. No acknowledgement has come from Meta at all on this though. My support request with them got a generic response and then ignored thereafter.

10月21日 03:16
Olly

It's a shame accountability hasn't been taken, we rely on these tools to work properly and have no control over them so at the very least we should be given an explanation on what went wrong. But I assume the truth of the matter is a developer pushed their local code live and it wasn't QA'd properly.

10月21日 03:19
Robert

Still getting this but now it's a websocket connection

https://connect.facebook.net/signals/config/330423837344621?v=2.9.173&r=stable

e.exports = new a(function(a, b) {
    if (g() || !d() || !k())
        return;
    c.listen(function(a, c) {
        if (a == null || c == null || c === "" || n >= l)
            return;
        a = b.pluginConfig.get(a, "actionID");
        if (a == null)
            return;
        var d = a.portNumber;
        a = a.ttlInHour;
        var e = i(m);
        if (e != null && (new Date().getTime() - Number(e)) / (1e3 * 60 * 60) < a)
            return;
        n++;
        try {
            var f = new WebSocket("ws://localhost:" + d);
            f.onerror = function(a) {
                h(new Error("[ActionID Error] Send WS error"))
            }
            ;
            f.addEventListener("open", function(a) {
                f.send("aid=" + encodeURIComponent(c)),
                f.readyState === WebSocket.OPEN && j(m, new Date().getTime()),
                f.close()
            })
        } catch (a) {
            a instanceof Error && Object.prototype.hasOwnProperty.call(a, "message") && (a.message = "[ActionID Error] Send WS exception: " + a.message),
            h(a)
        }
    })
}
10月24日 07:50
Robert

Still getting this but now it's a websocket connection

https://connect.facebook.net/signals/config/330423837344621?v=2.9.173&r=stable

e.exports = new a(function(a, b) {
    if (g() || !d() || !k())
        return;
    c.listen(function(a, c) {
        if (a == null || c == null || c === "" || n >= l)
            return;
        a = b.pluginConfig.get(a, "actionID");
        if (a == null)
            return;
        var d = a.portNumber;
        a = a.ttlInHour;
        var e = i(m);
        if (e != null && (new Date().getTime() - Number(e)) / (1e3 * 60 * 60) < a)
            return;
        n++;
        try {
            var f = new WebSocket("ws://localhost:" + d);
            f.onerror = function(a) {
                h(new Error("[ActionID Error] Send WS error"))
            }
            ;
            f.addEventListener("open", function(a) {
                f.send("aid=" + encodeURIComponent(c)),
                f.readyState === WebSocket.OPEN && j(m, new Date().getTime()),
                f.close()
            })
        } catch (a) {
            a instanceof Error && Object.prototype.hasOwnProperty.call(a, "message") && (a.message = "[ActionID Error] Send WS exception: " + a.message),
            h(a)
        }
    })
}
10月24日 07:50
Robert

Still getting this but now it's a websocket connection

https://connect.facebook.net/signals/config/330423837344621?v=2.9.173&r=stable

e.exports = new a(function(a, b) {
    if (g() || !d() || !k())
        return;
    c.listen(function(a, c) {
        if (a == null || c == null || c === "" || n >= l)
            return;
        a = b.pluginConfig.get(a, "actionID");
        if (a == null)
            return;
        var d = a.portNumber;
        a = a.ttlInHour;
        var e = i(m);
        if (e != null && (new Date().getTime() - Number(e)) / (1e3 * 60 * 60) < a)
            return;
        n++;
        try {
            var f = new WebSocket("ws://localhost:" + d);
            f.onerror = function(a) {
                h(new Error("[ActionID Error] Send WS error"))
            }
            ;
            f.addEventListener("open", function(a) {
                f.send("aid=" + encodeURIComponent(c)),
                f.readyState === WebSocket.OPEN && j(m, new Date().getTime()),
                f.close()
            })
        } catch (a) {
            a instanceof Error && Object.prototype.hasOwnProperty.call(a, "message") && (a.message = "[ActionID Error] Send WS exception: " + a.message),
            h(a)
        }
    })
}
10月24日 07:50
Robert

Still getting this but now it's a websocket connection

https://connect.facebook.net/signals/config/330423837344621?v=2.9.173&r=stable

e.exports = new a(function(a, b) { if (g() || !d() || !k()) return; c.listen(function(a, c) { if (a == null || c == null || c === "" || n >= l) return; a = b.pluginConfig.get(a, "actionID"); if (a == null) return; var d = a.portNumber; a = a.ttlInHour; var e = i(m); if (e != null && (new Date().getTime() - Number(e)) / (1e3 * 60 * 60) < a) return; n++; try { var f = new WebSocket("ws://localhost:" + d); f.onerror = function(a) { h(new Error("[ActionID Error] Send WS error")) } ; f.addEventListener("open", function(a) { f.send("aid=" + encodeURIComponent(c)), f.readyState === WebSocket.OPEN && j(m, new Date().getTime()), f.close() }) } catch (a) { a instanceof Error && Object.prototype.hasOwnProperty.call(a, "message") && (a.message = "[ActionID Error] Send WS exception: " + a.message), h(a) } }) }

10月24日 07:50
Robert

Still getting this but now it's a websocket connection

https://connect.facebook.net/signals/config/330423837344621?v=2.9.173&r=stable

10月24日 07:50
Robert

``` e.exports = new a(function(a, b) { if (g() || !d() || !k()) return; c.listen(function(a, c) { if (a == null || c == null || c === "" || n >= l) return; a = b.pluginConfig.get(a, "actionID"); if (a == null) return; var d = a.portNumber; a = a.ttlInHour; var e = i(m); if (e != null && (new Date().getTime() - Number(e)) / (1e3 * 60 * 60) < a) return; n++; try { var f = new WebSocket("ws://localhost:" + d); f.onerror = function(a) { h(new Error("[ActionID Error] Send WS error")) } ; f.addEventListener("open", function(a) { f.send("aid=" + encodeURIComponent(c)), f.readyState === WebSocket.OPEN && j(m, new Date().getTime()), f.close() }) } catch (a) { a instanceof Error && Object.prototype.hasOwnProperty.call(a, "message") && (a.message = "[ActionID Error] Send WS exception: " + a.message), h(a) } }) }

10月24日 07:52
Robert
// e.exports = new a(function(a, b) {
//     if (g() || !d() || !k())
//         return;
//     c.listen(function(a, c) {
//         if (a == null || c == null || c === "" || n >= l)
//             return;
//         a = b.pluginConfig.get(a, "actionID");
//         if (a == null)
//             return;
//         var d = a.portNumber;
//         a = a.ttlInHour;
//         var e = i(m);
//         if (e != null && (new Date().getTime() - Number(e)) / (1e3 * 60 * 60) < a)
//             return;
//         n++;
//         try {
//             var f = new WebSocket("ws://localhost:" + d);
//             f.onerror = function(a) {
//                 h(new Error("[ActionID Error] Send WS error"))
//             }
//             ;
//             f.addEventListener("open", function(a) {
//                 f.send("aid=" + encodeURIComponent(c)),
//                 f.readyState === WebSocket.OPEN && j(m, new Date().getTime()),
//                 f.close()
//             })
//         } catch (a) {
//             a instanceof Error && Object.prototype.hasOwnProperty.call(a, "message") && (a.message = "[ActionID Error] Send WS exception: " + a.message),
//             h(a)
//         }
//     })
// }
10月24日 07:53
Robert
//         try {
//             var f = new WebSocket("ws://localhost:" + d);
//             f.onerror = function(a) {
//                 h(new Error("[ActionID Error] Send WS error"))
//             }
//             ;
//             f.addEventListener("open", function(a) {
//                 f.send("aid=" + encodeURIComponent(c)),
//                 f.readyState === WebSocket.OPEN && j(m, new Date().getTime()),
//                 f.close()
//             })
//         } catch (a) {
//             a instanceof Error && Object.prototype.hasOwnProperty.call(a, "message") && (a.message = "[ActionID Error] Send WS exception: " + a.message),
//             h(a)
//         }
//     })
10月24日 07:53
Robert
//         try {
//             var f = new WebSocket("ws://localhost:" + d);
//             f.onerror = function(a) {
//                 h(new Error("[ActionID Error] Send WS error"))
//             }
10月24日 07:53
已選擇的答案
1

Another +1 here, and my client is in the EU region. I posted something similar to the forums (https://developers.facebook.com/community/threads/937149104821259/), but haven't heard anything.

9月30日 07:36
Dermot
1

Same here in Taipei

9月30日 23:49
Rory Huang
1

Hi guys, any update here? We're seeing it too. Though it seems it appears in console only sometimes, not all the time.

10月3日 01:42
Kuba
Kuba

Update: The error in console occurs only when we click on "Toggle device toolbar"

10月3日 02:40
1

same

10月4日 01:42
Maytas
1

Same here

10月4日 05:53
Nicolas
1

same here

10月8日 02:55
Arildo
1

same here

10月8日 13:08
Kauan
1

Same here. This is affecting the accuracy of advertisements. I can check with the relevant user agent for Androids

10月15日 01:48
Hitoshi Kojima
1

Same here, this error looks pretty ugly. Why is Facebook trying to connect to localhost? It looks very shady

10月29日 01:33
Daniel Wróblewski
1

Same issue here.

I spoke with Meta support on the phone and even shared a video showing the error and the exact line of code where it occurs. The pixel version affected on my site is v2.9.174. I was told they'll escalate the issue to the appropriate team.

The more attention we bring to this, the quicker it might get fixed, so I think others could report the issue too.

10月29日 20:05
Jorge
1

Same issue here

10月31日 13:07
Peeyoosh
1

Same problem here, ongoing since September 2024 (or earlier). Google Analytics shows: WebSocket connection to 'ws://localhost:12387/' failed: Error in connection establishment: net::ERR_NOT_IMPLEMENTED

11月13日 05:10
Glenn
2

same here in Seoul

9月24日 00:11
허성훈
3

it been couple weeks now. Any fix on this at all?

10月9日 03:49
Nuttakit
3

When is someone going to seriously fix this, come on facebook it's not good enough!

10月9日 12:17
Simon
4

This looks to be resolved now if you want to check.

10月10日 07:48
Tim
Renato

for me too, thanks!

10月10日 11:06
5

same here!

9月23日 11:03
Álvaro