Even for JS errors, the Facebook Sharing Debugger can reveal server-side issues that affect the JS SDK. Enter your page URL – the debugger often returns detailed error codes that match your console errors.
The most common legitimate JS error you will encounter in n8n workflows is the 190 OAuthException. This occurs when a Facebook Access Token expires or is revoked.
The "Best" Way to Handle This:
Instead of letting the workflow fail, use an Error Trigger node or a Try/Catch pattern. n8facebook3jsi7jserrore best
Do not rely on console logs alone. Wrap your FB API calls:
try
FB.api('/me', function(response)
if (response && response.error)
console.table(response.error);
// Save to external log: error.code, error.type, error.message
);
catch (e)
console.error('Full error object:', JSON.stringify(e, Object.getOwnPropertyNames(e)));
n8n automatically parses JSON responses. However, Facebook's API sometimes returns "wrapped" JSON or inconsistent structures (e.g., an empty object {} instead of a data array). Even for JS errors, the Facebook Sharing Debugger
If you try to reference $json.data.id in a Function node or an Expression, and Facebook returns an error object instead, n8n throws a ReferenceError.
The Solution: Use the Code Node with defensive programming. n8n automatically parses JSON responses
// Instead of direct referencing: // return items[0].json.data.id;
// Use optional chaining: const postId = items[0].json?.data?.id || 'fallback_or_error_handling'; return postId ;