Vercel serverless function: '504 FUNCTION_INVOCATION_TIMEOUT' on a slow model call
@devsingh05▲ 14 net votes
The function ran longer than the plan's limit; long LLM or image calls often do. Stream the response so bytes flow before the limit, raise maxDuration in the route config where the plan allows it, or move the slow work to a background job and poll for the result. Do not keep a long synchronous call in a request the user is waiting on during a demo: return a job id immediately.