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;
};
// 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 ??????!!!
}
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
1 Reply
Liltripple_reid
Liltripple_reid8mo ago
logging the cookie itself shows this
{
workspace: Promise {
'arq-studios',
[Symbol(async_id_symbol)]: 147121,
[Symbol(trigger_async_id_symbol)]: 137107,
[Symbol(kResourceStore)]: undefined,
[Symbol(kResourceStore)]: {
headers: [Getter],
cookies: [Getter],
mutableCookies: [Getter],
draftMode: [Getter]
},
[Symbol(kResourceStore)]: {
isStaticGeneration: false,
urlPathname: '/integrations/github?code=709726aa96755578ac0d',
pagePath: '/(public)/integrations/github/page',
incrementalCache: [IncrementalCache],
isRevalidate: false,
isPrerendering: undefined,
fetchCache: undefined,
isOnDemandRevalidate: false,
isDraftMode: false,
postpone: undefined,
fetchMetrics: [Array],
forceDynamic: true,
revalidate: 0,
tags: [Array],
nextFetchId: 5
},
{
workspace: Promise {
'arq-studios',
[Symbol(async_id_symbol)]: 147121,
[Symbol(trigger_async_id_symbol)]: 137107,
[Symbol(kResourceStore)]: undefined,
[Symbol(kResourceStore)]: {
headers: [Getter],
cookies: [Getter],
mutableCookies: [Getter],
draftMode: [Getter]
},
[Symbol(kResourceStore)]: {
isStaticGeneration: false,
urlPathname: '/integrations/github?code=709726aa96755578ac0d',
pagePath: '/(public)/integrations/github/page',
incrementalCache: [IncrementalCache],
isRevalidate: false,
isPrerendering: undefined,
fetchCache: undefined,
isOnDemandRevalidate: false,
isDraftMode: false,
postpone: undefined,
fetchMetrics: [Array],
forceDynamic: true,
revalidate: 0,
tags: [Array],
nextFetchId: 5
},
Want results from more Discord servers?
Add your server