fix health check endpoint
This commit is contained in:
4
create-agentic-app/package-lock.json
generated
4
create-agentic-app/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "create-agentic-app",
|
||||
"version": "1.1.20",
|
||||
"version": "1.1.21",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "create-agentic-app",
|
||||
"version": "1.1.20",
|
||||
"version": "1.1.21",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"chalk": "^5.3.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "create-agentic-app",
|
||||
"version": "1.1.20",
|
||||
"version": "1.1.21",
|
||||
"description": "Scaffold a new agentic AI application with Next.js, Better Auth, and AI SDK",
|
||||
"type": "module",
|
||||
"bin": {
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
- [ ] Add rate limiting (10 requests/minute per user)
|
||||
- [ ] Add Zod validation for messages
|
||||
- [ ] Add message length limits
|
||||
- [ ] Modify `src/app/api/diagnostics/route.ts` - Restrict to authenticated admins
|
||||
- [x] Modify `src/app/api/diagnostics/route.ts` - Keep public (used by homepage setup checklist before login)
|
||||
|
||||
### SEO
|
||||
- [ ] Modify `src/app/layout.tsx` - Add Open Graph metadata
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import { headers } from "next/headers";
|
||||
import { NextResponse } from "next/server";
|
||||
import { auth } from "@/lib/auth";
|
||||
|
||||
type StatusLevel = "ok" | "warn" | "error";
|
||||
|
||||
@@ -33,15 +31,10 @@ interface DiagnosticsResponse {
|
||||
overallStatus: StatusLevel;
|
||||
}
|
||||
|
||||
// This endpoint is intentionally public (no auth required) because it's used
|
||||
// by the setup checklist on the homepage before users are logged in.
|
||||
// It only returns boolean flags about configuration status, not sensitive data.
|
||||
export async function GET(req: Request) {
|
||||
// Require authentication for diagnostics endpoint
|
||||
const session = await auth.api.getSession({ headers: await headers() });
|
||||
if (!session) {
|
||||
return NextResponse.json(
|
||||
{ error: "Unauthorized. Please sign in to access diagnostics." },
|
||||
{ status: 401 }
|
||||
);
|
||||
}
|
||||
const env = {
|
||||
POSTGRES_URL: Boolean(process.env.POSTGRES_URL),
|
||||
BETTER_AUTH_SECRET: Boolean(process.env.BETTER_AUTH_SECRET),
|
||||
|
||||
Reference in New Issue
Block a user