# Handling dynamic JS execution when writing automated server-side data fetchers?

**URL:** <https://community.agoric.com/t/handling-dynamic-js-execution-when-writing-automated-server-side-data-fetchers/959>\
**Category:** General\
**Created:** [August 15, 2026, 3:15pm UTC](https://community.agoric.com/t/handling-dynamic-js-execution-when-writing-automated-server-side-data-fetchers/959 "2026-08-15T15:15:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ninaokaf535](https://avatars.discourse-cdn.com/v4/letter/n/df705f/32.png) [@ninaokaf535](https://community.agoric.com/u/ninaokaf535)\
**Post date:** [August 15, 2026, 3:15pm UTC](https://community.agoric.com/t/handling-dynamic-js-execution-when-writing-automated-server-side-data-fetchers/959/1 "2026-08-15T15:15:48Z")

</div>

Hey everyone,  
I’m hoping to get some technical advice from anyone building automated off-chain workers or server-side bots.

I am setting up a lightweight background script on a node server to fetch dynamic billing/utility statements automatically, pull the balance data, and trigger payment notifications or on-chain events. The script sends HTTP GET/POST requests with a consumer reference ID to fetch the current statement.

The problem is that the target server returns a blank shell, or the connection hangs, because the form relies heavily on client-side JavaScript execution to render the balance details and PDF download links. I checked the input parameters on [this website](http://mepco-bills.pk/) to ensure my request payload wasn’t missing required fields, but while the page loads fine in a standard web browser, basic headless cURL or Axios requests fail to resolve the dynamic JS elements.

Has anyone dealt with similar dynamic execution hurdles when building off-chain data services? Do you typically run a headless Chromium instance via Playwright/Puppeteer inside a Docker container to evaluate the client-side JavaScript, or is there a lighter way to parse dynamic payload execution without overburdening server resources?

Thanks in advance for any insights!

---

<div class="post-metadata">

**Author:** ![michaellewis](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@michaellewis](https://community.agoric.com/u/michaellewis)\
**Post date:** [November 18, 2026, 8:52pm UTC](https://community.agoric.com/t/handling-dynamic-js-execution-when-writing-automated-server-side-data-fetchers/959/2 "2026-11-18T20:52:39Z")

</div>

Before reaching for a browser, open devtools on the working page, filter Network to XHR/fetch, and reload—balance figures and PDF links usually come from a JSON endpoint the JS calls. If you can reproduce that request (same headers, cookies/session token, maybe a CSRF value from the initial HTML), plain Axios is far lighter than Chromium. When the JS builds the markup itself with no separate API, Playwright in Docker is the pragmatic fallback; run it headless with images/fonts blocked, reuse one browser context, and set short timeouts so a hang doesn’t pin your worker. Also check the site’s terms on automated access.
