Skip to content

Conversation

YKaizer
Copy link

@YKaizer YKaizer commented Jul 2, 2025

This pull request fixes a TypeScript error in modal-login/app/layout.tsx that prevents the project from building successfully.

🔥 Problem

When executing ./run_rl_swarm.sh, the following error is thrown during the server build phase (captured in yarn.log):

./app/layout.tsx:25:15
Type error: Property 'get' does not exist on type 'Promise<ReadonlyHeaders>'.

  23 |   const initialState = cookieToInitialState(
  24 |     config,
> 25 |     headers().get("cookie") ?? undefined,
     |               ^
  26 |   );
  27 |
  28 |   return (
Next.js build worker exited with code: 1 and signal: null
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

This is caused by an attempt to access .get("cookie") on a Promise instead of the resolved headers() object. The root function (RootLayout) was not declared async, so the await was missing when calling headers().

✅ Fix

  • Converted RootLayout to async
  • Added await headers() before reading cookie data

✅ Result

This fix resolves the TypeScript error and allows run_rl_swarm.sh to complete the build without crashing.

Let me know if you'd like me to adjust anything. Happy to iterate!

YKaizer added 2 commits July 2, 2025 15:53
Fixes a TypeScript error where layout.tsx was trying to access `.get()` on a Promise<ReadonlyHeaders>.
Added await (or equivalent fix) to properly resolve the headers before accessing cookies.
Fix: resolve TypeError in layout.tsx due to async headers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant