You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

28 lines
977 B

// Custom Next.js server with extended timeout for video generation
// Node.js default server.requestTimeout is 5 minutes (300,000ms)
// We extend it to 10 minutes for long-running fal.ai video generation
const { createServer } = require('http');
const next = require('next');
const dev = process.env.NODE_ENV !== 'production';
const hostname = 'localhost';
const port = process.env.PORT || 3000;
const app = next({ dev, hostname, port });
const handle = app.getRequestHandler();
app.prepare().then(() => {
const server = createServer(async (req, res) => {
await handle(req, res);
});
// Increase timeout to 10 minutes for long-running video generation
server.requestTimeout = 600000; // 10 minutes
server.headersTimeout = 610000; // Slightly longer than requestTimeout
server.listen(port, () => {
console.log(`> Ready on http://${hostname}:${port}`);
console.log(`> Server timeout set to ${server.requestTimeout / 1000 / 60} minutes`);
});
});