Skip to content

Commit

Permalink
exclude api/stream from nextjs trying to pre-render it which leads to…
Browse files Browse the repository at this point in the history
… timeout while generating static routes/pages. This eventually lead to the build timing out and failing
  • Loading branch information
adnanhashmi09 committed Oct 3, 2024
1 parent 588ed91 commit 9f5f552
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions web-server/app/api/stream/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,9 @@ export async function GET(): Promise<Response> {
}
});
}

// This line is necessary to prevent Next.js from attempting to statically generate this API route.
// It forces the route to be dynamically rendered on each request, which is crucial for our
// real-time streaming functionality. Without this, Next.js might try to pre-render the route
// during build time, leading to timeouts or incorrect behavior.
export const dynamic = "force-dynamic";

0 comments on commit 9f5f552

Please sign in to comment.