I'm getting this for absolute no reason: Error: async/await is not yet supported in Client Component
Answered
Ojos Azules posted this in #help-forum
Ojos AzulesOP
I have two pages. Both of them has this code on them:
They're organized in the following file structure:
When I use the navigation arrows of the browser to go to one another, I get the following error:
Error: async/await is not yet supported in Client Components, only Server Components. This error is often caused by accidentally adding 'use client' to a module that was originally written for the server.
I'm using Next.js 14.2.4.
I created another file structure like that, with literally the same code on the pages, like this:
And I don't get that error when I navigate to one another.
What could this possibly be? It makes no sense.
- File structure and code are identical.
- There're no configuration differences that might cause this.
- I've already tried to deleted the .next folder.
export default async function Page({ params }: { params: { page: number } }) {
return (
<>
</>
)
}
They're organized in the following file structure:
/reminders/
/done/
[page]
page.tsx
/undone/
[page]
page.tsx
When I use the navigation arrows of the browser to go to one another, I get the following error:
Error: async/await is not yet supported in Client Components, only Server Components. This error is often caused by accidentally adding 'use client' to a module that was originally written for the server.
I'm using Next.js 14.2.4.
I created another file structure like that, with literally the same code on the pages, like this:
/test/
/one/
[page]
page.tsx
/two/
[page]
page.tsx
And I don't get that error when I navigate to one another.
What could this possibly be? It makes no sense.
- File structure and code are identical.
- There're no configuration differences that might cause this.
- I've already tried to deleted the .next folder.
Answered by MikeTheTechLead
Check layout.tsx as well to see if there's a client component which uses an async component
5 Replies
Check the console logs
The browser ones too
Maybe(and i am not sure), just maybe the route is being switched to client rendering due to some issue
Check layout.tsx as well to see if there's a client component which uses an async component
Answer
Ojos AzulesOP
There was a hidden (with css) client component using async in layout. What I still wonder is why the other pages didn't trigger the same error...