Port number is IP address causing 400 error in s-GTM


Sorry if this should have gone in the GTM category, this is a FB CAPI issue in s-GTM.

The Stape serverr tag fire but the tag fails because of this issue:

{“error”:{“message”:“Invalid parameter”,“type”:“OAuthException”,“code”:100,“error_subcode”:2804007,“is_transient”:false,“error_user_title”:“Invalid IP address”,“error_user_msg”:“The IP address you’ve entered is invalid. Enter a valid IP address.”,“fbtrace_id”:“A9vqn8LT2oj0di7dGIG5VLw”}}

When investigating the response body, I can see the port number in the IP address:
{“data”:[{“event_name”:“PageView”,“action_source”:“website”,“event_source_url”:“https://www.[domain]/?gtm_debug=[ID number]”,“event_time”:1687169125,“custom_data”:{},“user_data”:{“client_user_agent”:“Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36”,“client_ip_address”:“[my IP]:51185”,“fbp”:“fb.1.1687169124595.1743161412”},“event_id”:“1687169125483.413950.405”}],“partner_agent”:“stape-gtmss-2.0.0”,“test_event_code”:“TEST7744”}

How can I resolve this issue?

Hi, are you overwriting the ip aders parameter in the server Facebook tag?
Also, are you transferring data from the web to the server via GA4 tag / Data tag or something else?
What data do you see in the ip_override parameter in the event data in preview mode of the server container?

Hi Alex

Here’s a screen shot of the FB server tag, you can see nothing about the IP address is being manipulated

Yes, data is being trasferred from web to server via GA4 client tag

The ip_override parameter value in event data shows my IP and the port number

Seems strange, haven’t seen this before, are you using the localhost version of the site?

I’m not sure what you mean, and you referring to the server container URL?

Your problem is not in the Facebook tag, because the tag uses the ip_override parameter in which you are using an incorrect value. I assume you use your own hosting for sGTM? If so, most likely the problem could be in your reverse proxy settings.
I think the easiest way is to create a separate variable that will take the port out of your ip_override, for example with .split()

Thanks Alex, I’ll speak to my developer and report back