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.