JSON.stringify(err.response.config) in clob-client's errorHandling
includes the httpsAgent (HttpsProxyAgent) object which has circular/deep
refs, causing "Maximum call stack size exceeded" on every API error.
- Fixed live node_modules file to log only status + data (no config)
- Updated patch script to apply this fix idempotently after npm install,
independent of proxy patch (two separate checks/markers)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The CLOB client errorHandling function does JSON.stringify on
err.response.config which includes httpsAgent (HttpsProxyAgent with
circular references). Inject a safe serializer that strips agent
properties before serializing.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The IIFE approach that injected httpsAgent into the request config
caused "Converting circular structure to JSON" when the CLOB client
serialized the config object (HttpsProxyAgent has circular refs).
New approach: register an axios request interceptor after the axios
import. This is simpler (no need to find request config patterns),
works with any code format, and avoids serialization issues since
axios handles httpsAgent internally after interceptors run.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The VPS fresh install uses `(0, axios_1.default)({ method, url: endpoint, ... })`
instead of a separate `config` variable. Add Format B regex to match this
inline pattern and wrap it in an IIFE that injects the proxy agent.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Rewrite patch-clob-client.cjs to use regex instead of exact string
matching, so it works regardless of code formatting differences
between npm versions (fixes "Could not find request config line" on
fresh VPS install)
- Add multiple fallback patterns (config regex → fallback regex →
axios call injection) with debug output if all fail
- Add Polymarket geoblock API check (polymarket.com/api/geoblock)
for both VPS direct IP and proxy IP at startup
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The proxy patch in node_modules is lost on every fresh npm install.
This postinstall script automatically patches @polymarket/clob-client
http-helpers to inject HttpsProxyAgent for all polymarket.com requests.
Runs automatically after npm install — no manual patching needed on VPS deploy.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>