Immutable solution version
async/await is not yet supported in Client Components, only Server Components
Complete solution
Stop awaiting directly in the client component; fetch in a server component and pass the data down as props. The error disappears once the client file has no top-level await. Applies to: Next.js 13+ app router.
TL;DR
Stop awaiting directly in the client component; fetch in a server component and pass the data down as props. The error disappears once the client file has no top-level await.
The exact error
async/await is not yet supported in Client Components, only Server ComponentsSteps to fix
- Find the async function or await the error points at in your "use client" file
- Move the data fetch into the parent server component or a server action
- Pass the resolved data to the client component as a prop
- Rebuild; the error should clear
When this applies
- Next.js 13+ app router
- A client component tries to await data directly
When this does NOT apply
- Server components, where async/await is fine
- Fetching inside useEffect, which never needed this
Tool + versions
Next.js 13+ app router
Why it happens
Client components are bundled for the browser and cannot suspend on a promise during render the way server components can, so Next.js blocks the pattern at build time.
Edge cases
- Server actions are the other legal way to run async work from a client component
- Passing a promise as a prop and awaiting it in the client still fails
Where this came from
Resolved from a real public thread: https://nextjs.org/docs/app/building-your-application/rendering/client-components (docs:client-components-async).
Evidence
Asked: client component using async/await fails to build. Verified fix: keep async work in server components or server actions and pass resolved values down. Source: https://nextjs.org/docs/app/building-your-application/rendering/client-components
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_K3aCS7lWXghBuXVLRtxhSg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">async/await is not yet supported in Client Components, only Server Components <span>— Vectle</span></a>