TypeError: Cannot read property 'short_name' of undefined from postResponseMap script

I'm getting this error intermittently, but the Error Details clearly show that the 'customer' object containing 'short_name' is in the payload:

{
    "Id": 9999999999,
    "SubscriberId": 9999999999,
    "StoreId": "9999",
    "Name": "XXXXXX-BLVD-LAS VEGAS",
    "City": "Las Vegas",
    "customer": {
        "id": "9999",
        "recordType": "customer",
        "Internal ID": "9999",
        "External ID": "XX_999999",
        "Name": "Xxxxx",
        "short_name": "XXX"
    },
    "customerErrors": ,
    "customerStatus": 200
}

This is happening in a postResponseMap script following a NetSuite Customer lookup. The results mapping adds the 'customer' object to the payload. It's behaving as if the script is running before the 'customer' key has been added.

This only happens intermittently so I can't see how there could be anything wrong with my results mapping or script. I've played around with paging (the export is HTTPS) to see if that might be causing it, but no luck.

Any ideas?

The postResponseMap script runs on an entire page of data, so if one record within that page of data causes the script to fail, then all records in that page will fail. Are you sure the customer object is in all the records? I assume you may have cases where a customer is not found.

Thanks, Tyler, I will look into that.

Sounds good. One way to narrow it down would be to set your page size to 1 on your export; that way, the script will only run with one record on its page. Another way could be to console.log the record where !customer. These will help identify which record is the issue.