Partial Outageshare-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
Asked about 2 months ago
Peter

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

September 22 at 8:33 PM
Nuttakit

same here

September 23 at 3:09 AM
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

September 24 at 3:19 AM
Daniel

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

September 26 at 1:07 PM
Nemrod

Same here...

September 27 at 1:20 PM
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.

October 21 at 3:16 AM
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.

October 21 at 3:19 AM
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)
        }
    })
}
October 24 at 7:50 AM
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)
        }
    })
}
October 24 at 7:50 AM
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)
        }
    })
}
October 24 at 7:50 AM
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) } }) }

October 24 at 7:50 AM
Robert

Still getting this but now it's a websocket connection

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

October 24 at 7:50 AM
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) } }) }

October 24 at 7:52 AM
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)
//         }
//     })
// }
October 24 at 7:53 AM
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)
//         }
//     })
October 24 at 7:53 AM
Robert
//         try {
//             var f = new WebSocket("ws://localhost:" + d);
//             f.onerror = function(a) {
//                 h(new Error("[ActionID Error] Send WS error"))
//             }
October 24 at 7:53 AM
Selected Answer
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.

September 30 at 7:36 AM
Dermot
1

Same here in Taipei

September 30 at 11:49 PM
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.

October 3 at 1:42 AM
Kuba
Kuba

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

October 3 at 2:40 AM
1

same

October 4 at 1:42 AM
Maytas
1

Same here

October 4 at 5:53 AM
Nicolas
1

same here

October 8 at 2:55 AM
Arildo
1

same here

October 8 at 1:08 PM
Kauan
1

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

October 15 at 1:48 AM
Hitoshi Kojima
1

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

October 29 at 1:33 AM
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.

October 29 at 8:05 PM
Jorge
1

Same issue here

October 31 at 1:07 PM
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

November 13 at 5:10 AM
Glenn
2

same here in Seoul

September 24 at 12:11 AM
허성훈
3

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

October 9 at 3:49 AM
Nuttakit
3

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

October 9 at 12:17 PM
Simon
4

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

October 10 at 7:48 AM
Tim
Renato

for me too, thanks!

October 10 at 11:06 AM
5

same here!

September 23 at 11:03 AM
Álvaro