Cookies being set with empty values in production in Next.js

I am trying to set cookies using the cookies function in Next.js and it’s working completely fine on localhost but the cookie values are empty in production. Also, the cookies are being set by the Next.js server itself. This is how I am setting it:

const cookieStore = cookies();

cookieStore.set({
  name: "accessToken",
  value: res.data?.google?.access,
  httpOnly: true,
  secure: true,
  path: "/",
  maxAge: 3600,
  expires: new Date(Date.now() + 3600),
  sameSite: "strict",
});

cookieStore.set({
  name: "refreshToken",
  value: res.data?.google?.refresh,
  httpOnly: true,
  secure: true,
  path: "/",
  maxAge: 7 * 24 * 60 * 60,
  expires: new Date(Date.now() + 7 * 24 * 60 * 60),
  sameSite: "strict",
});

I tried these solutions: Client not saving cookies in production, Cookies are not being set in production, Cookies Not Being Set in Production in Next.js App.

None of these solutions worked for me.

PS: I am using Next.js V15 rc.