-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: 7.22.0 next build error TRPCClientError: Dynamic server usage #1599
Comments
this fix got rid of the issue for me - should it ship with by default? |
The version released for this Merged is 7.22.0, which is what I'm using, and when my nextjs selects appdir and package management uses pnpm, the problem must exist, I've tried it over and over again a few times. |
Same happening here! |
Thanks for the issue. Can reproduce. Weirdly enough this issue exists for the |
I was trying to investigate this and I'm reading this page but I'm not understanding anything about it. If someone understands this in some way and would like to explain in more layman's terms, I would appreciate it.
|
Update: was spreading misinformation, still no real solution. Edited with comments. @c-ehrlich While I have no idea why it happens, like you said, here is some info from my limited testing, that I hope proves useful. :) I can see that using When I instead move the provider elsewhere, and only have it wrap the actual components that wish to access
Now, not saying this is a solution but leaving this here hoping it is helpful to someone, until we find a better one...
-- P.S. Not sure how wrapping each element in // layout.tsx
<html lang="en">
<body>
<main>
<WrapOnlyClient
wrapper={
<TRPCReactProvider headers={headers()}>
{children}
</TRPCReactProvider>
}
>
{children}
</WrapOnlyClient>
</main>
</body>
</html> In this scenario, the page will SSR as-is, and will have no provider during SSR, but will actually have a provider in the client, allowing the client components to do their work. The major issue with this is that you then also must ensure that you don't mount (only) the offending client components during SSR, effectively making them client-only or mounted-only. // some/page.tsx
<OnlyClient><ContainsTrpcCalls /></OnlyClient> |
The following wrapper (WrapOnlyClient) does not work in my repo... Finally, I commented out the "hello" on app/page.tsx to delete the TRPCClientError... // layout.tsx <WrapOnlyClient wrapper={ {children} } > {children} |
Experienced this issue today also when trying to build a new app with the latest T3 + App Router. |
Same issue here |
Idk what @KATT thinks but i'd say this issue should be tracked in trpc as it's something we should look into from there on how to properly recommend using trpc/react-query and forwarding headers correctly? |
I only found these in the example bundled with t3, I never found it in any of my other projects. I experimented by splitting all I suspect, it's Next.js trying to make all RSC static by default and only parts of its page are interactable which is dynamic. Whenever Next.js detects |
Wrapping the components in Suspense worked as a temporary solution for me as well. |
Switching from node 18 to 20 fixes this for me |
That seems random since it doesn’t appear to be a node issue rather Next throwing a valid error..? |
Doesn't work for me |
+1 on this bug report, I'm running node v20.9.0 |
Same issue for me, and the funny thing is it doesn't happen to all pages. Some pages are completely fine and the setup is exactly the same, just calling for different data from the db. The website still deploys on Vercel and works as expect. This is the only time I see red in deploy log and it still manages to complete the build. |
Encounterd this issue today. Any solutions devs? |
This also happens on my side, it is impossible to generate static pages, it is limiting everything to SSR. |
Same bug today for me |
Having the same issue. |
So, this is not causing a build issue anymore, but it is forcing all routes to become force-dynamic because of the use of headers and cookies I think. Even without using trpc on a barebones page.tsx. Anyone know of a workaround? "initVersion": "7.24.0" |
@keelangibb might be worth opening a new issue over and referencing this one in that one? Technically, this issue is resolved and should be closed, but obviously the behavior you're experiencing is problematic. |
Just did a pull of the repo today and was still getting the bug mentioned by OP, in just the base T3 app. I have been reading a ton of these threads and managed to find a few work arounds, but they all seem like a rather quick fix Band-Aid than an actual solution. Is there any recommendation by the T3 team on how to bypass this error or is it safe to ignore because the app still technically builds? |
Also getting Dynamic server usage: Page couldn't be rendered statically because it used |
So how exactly do you fix this? |
Curious if this is something we can fix, do we need |
This seems to be a solution: https://github.com/orgs/vercel/discussions/4696#discussioncomment-7494345
|
* feat: begin creating Role Review Cards * feat: assembled Role Page Made role review cards update based on db, put together components for roles page, made search bar slightly more responsive, updated header logo sizing, edited logo font per design * feat: create header layout component to standardize header placement * fix: removed async from exports (not needed) * fix: made search filter (whole bar) more responsive" * fix: edit roles/page to prevent tRPC error.t3-oss/create-t3-app#1599 * docs: add TODO and FIXME tags * refactor: implemented changes suggested in PR. Started to work on style changes for header
Provide environment information
"ct3aMetadata": {
"initVersion": "7.22.0"
},
Describe the bug
Reproduction repo
.
To reproduce
when:
pnpm create t3-app@latest
pnpm build
Additional information
No response
The text was updated successfully, but these errors were encountered: