cancel
Showing results for 
Search instead for 
Did you mean: 

HTTP Client Pagination with $_debug

jhipp
New Contributor

Hi All,

I recently turned on an integration that only runs for about a month in the spring and in the fall when I'm pushing some data from a training system into our ERP and noticed it started failing. After looking through the logs, it looks like it's failing on a reference to $_debug, which was integral to the solution I had created a while back.

For what it's worth, here's a link to a previous post where it was suggested to use $_debug to accomplish pagination.

https://community.snaplogic.com/t5/designing-and-running-pipelines/pagination-in-http-client-snap/m-... 

When running the pipeline now using the following as the override value for page I get this:

page value: parseInt($_debug.request.requestLine.match("page=([0-9]+)")[1]) + 1

Failure: $_debug is undefined. Perhaps you meant: $entity, $headers, $statusLine, Reason: '_debug' was not found while evaluating the sub-expression '$_debug', Resolution: Check the spelling of the property or, if the property is optional, use the get() method (e.g. $.get('_debug'))

I've tried the suggested fix from the error message and get a "Cannot lookup a property on a null value" failure message. I've tried so many permutations that I've lost track.

Is there something that changed with $_debug? Is there anyway I can bypass that and still get the requestLine from the request? Any help is greatly appreciated!

1 ACCEPTED SOLUTION

ddellsperger
Moderator
Moderator

The `$_debug` object is only available in the output document, it's not available for pagination due to how the processing for paging works. I would suggest using the `snap.out.totalCount` to keep track of your paging (noting that the first page will use `snap.out.totalCount` being set to `0`.

View solution in original post

2 REPLIES 2

ddellsperger
Moderator
Moderator

The `$_debug` object is only available in the output document, it's not available for pagination due to how the processing for paging works. I would suggest using the `snap.out.totalCount` to keep track of your paging (noting that the first page will use `snap.out.totalCount` being set to `0`.

Thanks for the quick reply, that worked. I needed to take that one snap and put it in a child pipeline because I have multiple input documents so the snap.out.totalCount would be off for every input that wasn't the first.

Thanks again!