79427042

Date: 2025-02-10 12:23:39
Score: 1
Natty:
Report link

why my cookieStore is an empty array in server api function

import { cookies } from "next/headers";
import { NextRequest, NextResponse } from "next/server";

export async function GET(req: NextRequest) {
  const cookieStore = cookies();
  console.log((await cookieStore).getAll())
  const response = NextResponse.json({ isAuthenticated: !!token });
  
  return response;
}
Reasons:
  • Has code block (-0.5):
  • Starts with a question (0.5): why
  • Low reputation (1):
Posted by: Nuquernalach