{
  "id": "nextjs/edge-runtime-fetch-aborted",
  "signature": "Error: The operation was aborted. (Edge Runtime) / fetch failed: aborted",
  "signature_zh": "错误：操作被中止（边缘运行时）/ 获取失败：已中止",
  "regex": "Error: The operation was aborted\\.|fetch failed: aborted",
  "domain": "nextjs",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A fetch request in the Edge Runtime (middleware or edge function) exceeded the 30-second timeout or was aborted due to a resource limit, causing the request to be terminated prematurely.",
  "root_cause_type": "generic",
  "root_cause_zh": "边缘运行时（中间件或边缘函数）中的 fetch 请求超过了 30 秒超时或由于资源限制被中止，导致请求提前终止。",
  "versions": [
    {
      "version": "Next.js 14.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Next.js 14.1.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Next.js 14.2.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Vercel Edge Runtime 2024",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The Edge Runtime has a hard 30-second timeout per request that cannot be overridden by client-side timeout options; the platform enforces this limit.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "XMLHttpRequest is not available in the Edge Runtime; only fetch and a subset of Web APIs are supported.",
      "fail_rate": 1.0,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The underlying timeout or resource limit will still apply on each retry, and infinite retries can exhaust memory or cause cascading failures.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Move the fetch logic to a Server Component or API route that runs on Node.js, which has no 30-second timeout limit. Example: create an API route at app/api/proxy/route.ts that performs the fetch and call it from the edge middleware.",
      "success_rate": 0.85,
      "how": "Move the fetch logic to a Server Component or API route that runs on Node.js, which has no 30-second timeout limit. Example: create an API route at app/api/proxy/route.ts that performs the fetch and call it from the edge middleware.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Optimize the fetch target to respond faster (e.g., add caching headers, reduce payload size, or use a CDN). Also ensure the fetch uses a reasonable timeout like { signal: AbortSignal.timeout(25000) } to fail gracefully before the hard limit.",
      "success_rate": 0.75,
      "how": "Optimize the fetch target to respond faster (e.g., add caching headers, reduce payload size, or use a CDN). Also ensure the fetch uses a reasonable timeout like { signal: AbortSignal.timeout(25000) } to fail gracefully before the hard limit.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If the fetch is in middleware, use `next: { revalidate: 60 }` in the fetch options to cache the response and reduce repeated calls.",
      "success_rate": 0.7,
      "how": "If the fetch is in middleware, use `next: { revalidate: 60 }` in the fetch options to cache the response and reduce repeated calls.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "将 fetch 逻辑移到运行在 Node.js 上的服务器组件或 API 路由中，这些组件没有 30 秒超时限制。示例：在 app/api/proxy/route.ts 中创建一个执行 fetch 的 API 路由，然后从边缘中间件调用它。",
    "优化 fetch 目标以更快响应（例如，添加缓存头、减少负载大小或使用 CDN）。同时确保 fetch 使用合理的超时，如 { signal: AbortSignal.timeout(25000) }，以便在硬限制之前优雅地失败。",
    "如果 fetch 在中间件中，在 fetch 选项中使用 `next: { revalidate: 60 }` 来缓存响应并减少重复调用。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://nextjs.org/docs/messages/edge-runtime-timeout",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.8,
  "resolvable": "partial",
  "first_seen": "2023-12-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}