fix: remove JSON.parse on axios response (auto-parses JSON)

axios auto-parses JSON responses, so response.data is already an object.
Calling JSON.parse on it throws a silent error, preventing the remote
browser connection from working.
This commit is contained in:
Tony Fruzza 2026-06-15 07:42:07 +00:00
parent 7943ec964f
commit ea5bf6798a

View file

@ -253,8 +253,8 @@ function extractGenericCssCandidates($: CheerioAPI): PriceCandidate[] {
async function getRemoteBrowserWSEndpoint(): Promise<string | null> {
const remoteUrl = process.env.REMOTE_BROWSER_URL || 'http://browser-node.openclaw.svc.cluster.local:9222';
try {
const response = await axios.get<string>(`${remoteUrl}/json/version`, { timeout: 5000 });
const data = JSON.parse(response.data);
const response = await axios.get<Record<string, string>>(`${remoteUrl}/json/version`, { timeout: 5000 });
const data = response.data; // axios auto-parses JSON
const wsUrl = data.webSocketDebuggerUrl;
if (wsUrl) {
// Replace localhost with the actual remote host