Issue
You need to verify the exact raw HTTP request body or JSON payload that a Segment Destination Function is sending to an external API. You might suspect that specific fields or parameters are being dropped, transformed, or excluded before reaching the downstream destination, and you need to inspect the actual outbound request for debugging purposes.
Product
Segment Functions
Environment
Segment Console
Cause
Logs generated by console.log() statements are only accessible in the Event Delivery view if the payloads encounter errors during processing. If the destination API returns a successful response (e.g., 200 OK) but silently drops improperly formatted data upon ingestion, Segment's execution logs will not display the raw outbound payload for you to inspect.
Resolution
To inspect the exact payload leaving Segment, you can temporarily route your function's outbound request to a test endpoint:
- Generate a temporary test endpoint URL using a free webhook inspection tool (such as Webhook.site or Beeceptor).
- Open your Destination Function code in the Segment Console.
- Temporarily replace the destination's actual API URL in your fetch() call with the newly generated test webhook URL.
- Trigger a test event through the Segment Source connected to this function, or use the "Use Sample Event" feature within the function editor to run a test.
- Navigate back to your webhook testing tool's dashboard to inspect the raw POST request arriving from Segment. This reveals the exact JSON payload and data types constructed and transmitted by your code.
- Once you have verified the payload, revert the endpoint URL in your Destination Function code back to the original production API and deploy the changes.
Additional Information
When troubleshooting dropped fields, pay close attention to the JavaScript variable types in your captured payload. Segment sends the payload exactly as your code constructs it via JSON.stringify(). Mismatched data types (such as passing a monetary value as a String instead of a Number) or undefined variables are common reasons why a downstream API might successfully accept a request but silently drop specific fields upon ingestion.