DIYgod/RSSHub · error · Error

No response received from ${apiUrl}

Error message

No response received from ${apiUrl}

What it means

Playwright's page.goto() resolves to the main request's response object, or null when navigation produces no response at all (the browser could not obtain any HTTP response for the top-level document). The Fortnite news route treats a null response as a hard failure because there is no status code or body to inspect. This is distinct from a non-OK status (handled separately) and indicates the request never completed at the transport level.

Source

Thrown at lib/routes/fortnite/news.ts:60

    // Use Playwright instead of got, which may be blocked by anti-crawling scripts with response code 403.
    const context = await playwright();
    const page = await context.newPage();

    // only document is allowed
    await page.route('**/*', (route) => {
        const request = route.request();
        request.resourceType() === 'document' ? route.continue() : route.abort();
    });

    // log manually (necessary for Playwright)
    logger.http(`Requesting ${apiUrl}`);
    let data;
    try {
        const response = await page.goto(apiUrl, {
            waitUntil: 'networkidle',
        });
        if (!response) {
            throw new Error(`No response received from ${apiUrl}`);
        }
        if (!response.ok()) {
            const statusText = response.statusText();
            const statusMessage = [response.status(), statusText].filter(Boolean).join(' ');
            throw new Error(`Fortnite API responded with ${statusMessage} for ${apiUrl}`);
        }
        const contentType = response.headers()['content-type'];
        if (!contentType?.includes('application/json')) {
            throw new Error(`Fortnite API returned non-JSON response with content-type ${contentType ?? 'unknown'}`);
        }

        data = await response.json();
    } finally {
        await page.close();
        await context.close();
    }

    const { blogList: list } = data;

View on GitHub (pinned to bed535e087)

Solutions

  1. Confirm the apiUrl is still valid by curling it directly outside Playwright.
  2. Check the route.abort/continue interceptor ensures document requests for the apiUrl host are allowed through.
  3. Lower or adjust waitUntil to 'domcontentloaded' if 'networkidle' never settles, and increase the navigation timeout.
  4. Verify outbound network/DNS from the RSSHub host.

Example fix

// before
const response = await page.goto(apiUrl, { waitUntil: 'networkidle' });
if (!response) {
    throw new Error(`No response received from ${apiUrl}`);
}

// after
const response = await page.goto(apiUrl, { waitUntil: 'domcontentloaded', timeout: 30000 });
if (!response) {
    throw new Error(`No response received from ${apiUrl} (navigation aborted, timed out, or blocked by interceptor)`);
}
Defensive patterns

Strategy: retry

Validate before calling

// pre-flight: confirm host resolves before launching Playwright
import { resolve } from 'node:dns/promises';
try { await resolve(new URL(apiUrl).hostname); } catch { throw new Error('DNS resolution failed'); }

Try / catch

try {
  const response = await page.goto(apiUrl, { waitUntil: 'domcontentloaded', timeout: 30000 });
  if (!response) throw new Error(`No response from ${apiUrl}`);
} catch (e) {
  // retry once with a fresh context, then surface
  throw e;
}

Prevention

When it happens

Trigger: The target apiUrl is unreachable due to DNS failure, a TCP/TLS connection error, a browser-level navigation timeout before any bytes arrived, or the page being closed/aborted by a request interceptor that mishandled the document resource type. Also occurs when Fortnite's API endpoint is decommissioned or returns a redirect loop.

Common situations: Running in an environment without outbound network access; the request interceptor (resourceType() === 'document' ? continue : abort) accidentally blocking the document; waitUntil: 'networkidle' timing out on a page that never goes idle; Fortnite rotating or deprecating the API URL.

Related errors


AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12). Data as JSON: /api/errors/85fc1a670c43c80f. Report an issue: GitHub.