cookies are returned as `object Promise` from RSC

not sure why this happens but here I am, based on the docs you should just be able to get cookies from any RSCs by calling
cookies().get(<name>)
however for some reason this is failing for me.

// server-actions.ts
export const getLatestWorkspace = () => {
  const store = cookies();
  return store.get(RECENT_WORKSPACE_KEY)?.value;
};

now using this on a page like
 const workspace = getLatestWorkspace();
  console.log({ workspace });
  
  // routes are from the nextjs-safe-navigation by lukemorales
  if (done.success) {
    redirect(routes.dashboard({ slug: workspace ?? "" })); // why is the final url is something like /%5Bobject%20Promise%5D ??????!!!
  }

the cookies DO NOT have the
SameSite
nor
HttpOnly
options set
Was this page helpful?