HTTP Node Pagination $response undefined on first run

Describe the problem/error/question

  1. On first run when use $response in pagination parameters value it’s throwing an error because data is undefined.
    image
    If I run first time without pagination and then try it’s working
    image
  2. I used {{ $response.body.toJsonString().parseJson()[0].id + 2 }} because {{ $response.body.id + 2 }} doesn’t work.
    image
    In other case i got this error
    “The returned response was identical 5x, so requests got stopped
    Check if “Pagination Completed When” has been configured correctly.” and I used this {{ !$response.body.last_page }}. So i think it’s the same case when request doesn’t have $response yet and error is thrown.
    BTW: documentation doesn’t mention anything about using ! with $response (HTTP Request | n8n Docs).

Please share your workflow

Test workflow

Information on your n8n setup

  • n8n version: 1.41.1
  • Database (default: SQLite): postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main): defaut
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker
  • Operating system: linux

Hey @rafuru! Thanks for reaching out and being a part of our community. You should use the $pageCount parameter in your query params. Pagination | n8n Docs

Updated your WF example to show this in action:

Happy building!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.