Edge Function unexpectedly timing out after ~5 seconds

Hi everyone,

I’m running a Next.js App Router project deployed on Vercel using Edge Functions for a lightweight API endpoint.

The function calls an external API and performs some light processing before returning the response.

However, I’m seeing requests consistently fail after ~5 seconds with a timeout error.

Setup

  • Next.js 14 (App Router)

  • Edge Runtime

  • External API call with fetch

  • Deployed via Vercel Git integration

export const runtime = ‘edge’

export async function GET() {
  const res = await fetch(“https://external-api.example.com/data”)
  const data = await res.json()

  return Response.json(data)
}

Observed behavior

  • Works locally

  • Works sometimes on Vercel

  • Occasionally fails with timeout

Questions

  • Is there a strict execution limit for Edge Functions?

  • Would switching to Serverless Functions avoid this issue?

  • Is there a recommended pattern for external API calls in Edge runtime?

Any insight would be appreciated.

Edge runs near the user, but your external API is usually in one region. Some requests will be “edge in far-away region → long round trip to API” and become flaky/slow. Occasional slow responses, TLS handshake delays, or throttling can look like random timeouts.
Also when the upstream gets slow, you wait until something upstream/proxy aborts.

especially when the work is “call an external API and wait” and that API latency is inconsistent. You can pin the function region to be near the external API (more stable than “near the user”). You get more mature reliability (Vercel’s own Edge Runtime docs explicitly recommend migrating to Node.js for improved reliability/performance).