Inconsistent input parameter with One to Many lookup JavaScript hook

I am working with a number of similar flows that have a postResponseMap JavaScript function after a lookup that has a One to many relationship. This is happening in multiple different flows.

The data structure looks something like this: (I don't know where the word “Copy” is coming from in the example, it doesn't show in the editor)

{
    "Batch": [
      {
        "Expenses": [
            {
                "Report": [
                    { "sample": "sample"}
                ]
            }
        ]
      }
    ]
}

The starting point is an export brining in the list of batches. The flow goes through the batches and then there's a look up for the Expenses for the batch.

The next step is a lookup to get the Report details for each expense object. That has a “One to many” relationship set up with Expenses as the "Path to many".

The issue:
Depending on how the postResponseMap function is triggered, we sometimes get the Batch array contents (Scenario A) and sometimes get the Expenses array contents (Scenario B), which is what we should be getting. Because of this, our code needs to be checking to see which one it received instead of simply trusting that it will get the correct data every time.

If I preview the script in the script editor, I get Scenario A. If I preview the next step in the flow, also with the same "One to many" setup, the script from the original step gets Scenario B.

If I run the flow in Production, the script gets Scenario A. If that gets an error and I rerun that step, the script gets Scenario B.

I don't believe this should be happening and we should be able to expect the same incoming data structure no matter how the script is triggered.

@drewcossey722 are these brand new scripts or existing scripts that you're looking at?

These are existing scripts. I'm new to the project though, so I'm not sure how old. I believe they were originally set up by a 3rd party but then worked on by Celigo staff until recently.

I'm assuming it's because of this then: https://docs.celigo.com/hc/en-us/articles/19068390655899-Celigo-platform-2023-9-1-release-notes#01H7XDZX7ZV7PKESP78P28TPPN.

My initial impression is that this is not related since we're only getting a single page of data either way and it's not a difference between a lookup vs. import. This is all on the same lookup step.

I will create some new flows and scripts to test this.

Thanks

@tylerlamparter That does appear to fix it, thanks!