Files
buzz-sheet/app/api/active/route.ts
T
gunshiz 87e6bcd96f
CI / Verify and audit (push) Successful in 2m33s
CI / Build, scan and deploy immutable images (push) Failing after 1m29s
feat : 6 astra improve it
2026-09-22 18:28:18 +07:00

24 lines
843 B
TypeScript

import { errorResponse } from "@/lib/security/http";
import { limitRequest, trustedClientAddress } from "@/lib/security/rate-limit";
import { connection } from "next/server";
import { normalizeDeploymentId } from "@/lib/deployment/version";
import { createEventStream, eventStreamHeaders } from "@/lib/events/sse";
export async function GET(request: Request) {
await connection();
try {
await limitRequest("stream-open", trustedClientAddress(request.headers), 60);
const deploymentId =
normalizeDeploymentId(process.env.NEXT_DEPLOYMENT_ID) ?? "development";
const channel = createEventStream({ signal: request.signal });
channel.sendNamed("deployment", deploymentId);
return new Response(channel.stream, {
headers: eventStreamHeaders(),
});
} catch (cause) {
return errorResponse(cause);
}
}