Skip to content

Missing timeout: test-server.js — 7 fetch() calls without AbortSignal.timeout() #681

@realfishsam

Description

@realfishsam

Location

core/src/server/test-server.js — lines 12, 19, 26, 45, 66, 87, 104

Code

// line 12
const response = await fetch(`${BASE_URL}/health`);

// line 19
const response = await fetch(`${BASE_URL}/version`);

// line 26
const response = await fetch(`${BASE_URL}/api/polymarket/fetchMarkets`, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ args: [{ limit: 5 }] })
});

// line 45
const response = await fetch(`${BASE_URL}/api/kalshi/searchMarkets`, { method: 'POST', ... });

// line 66
const response = await fetch(`${BASE_URL}/api/polymarket/getMarketsBySlug`, { method: 'POST', ... });

// line 87
const marketsResponse = await fetch(`${BASE_URL}/api/polymarket/searchMarkets`, { method: 'POST', ... });

// line 104
const response = await fetch(`${BASE_URL}/api/polymarket/fetchOHLCV`, { method: 'POST', ... });

Risk

If the local sidecar hangs (e.g., because a venue API call has no timeout — see issue #200), this test script will hang indefinitely with no indication of failure. Test runs block the terminal with no timeout, making CI or manual test sessions silently stall.

Affected Methods

All test functions in runAllTests():

  • testHealthCheck()
  • testVersion()
  • testFetchMarkets()
  • testSearchMarkets()
  • testGetMarketsBySlug()
  • testFetchOHLCV()

Suggested Fix

// Apply to every fetch() call in this file
const response = await fetch(`${BASE_URL}/health`, {
    signal: AbortSignal.timeout(15_000),
});

Found by automated missing timeout audit

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions