Replies: 10 comments 12 replies
-
You can't use getServerSideProps or getStaticProps with ssr: true, see #596 and https://trpc.io/docs/caching#app-caching for an alternative approach |
Beta Was this translation helpful? Give feedback.
-
Thanks for answering! Sorry that I missed that. Are there plans to allow enabeling SSR for specific site like this for example: |
Beta Was this translation helpful? Give feedback.
-
I'm bumping into the same issue after setting up tRPC in a freshly generated nextjs app. I am not using getServerSideProps at all, I basically just followed the guide for nextjs (which sets ssr: true by default in the example config). Here is the error I'm seeing in the logs:
in the actual app, i just see it stuck in the loading state. If i switch to a new tab and then return, that does something (re-renders the component maybe?) which allows the page to load fully. Its a bit weird. I published my repo, here is the commit where I add tRPC. Edit: I'm getting the same error even with an app generated by create-t3-app so that gives me some confidence that I don't have any obvious misconfigurations. Edit 2: i must be blind, my error is not even the same as the OP 🤦 |
Beta Was this translation helpful? Give feedback.
-
I'm getting a |
Beta Was this translation helpful? Give feedback.
-
I you are using prisma make sure |
Beta Was this translation helpful? Give feedback.
-
I'm seeing this error when doing a production build of my Next.js app (13).
Things seem to be working fine locally - However, no SSR requests are working when doing:
Here's a code snippet of my api file:
Million dollar question - why does this not work with a bundled version? Is anyone else having this issue? |
Beta Was this translation helpful? Give feedback.
-
Hello guys, has anyone fixed this issue? I'm also getting this error, BUT only if not authenticated in clerk :3 |
Beta Was this translation helpful? Give feedback.
-
My problem was that the url for the TRPC provider was configured incorrectly and causing a CORS error. I should not have used the |
Beta Was this translation helpful? Give feedback.
-
Hi all. To anybody searching for info: I've added a custom port to next which broke TRCP ( I have multiple dev processes running and I wanted to give one of the apps a custom port for convenience ). |
Beta Was this translation helpful? Give feedback.
-
Future readers of this thread, if your tRPC SSR works on dev but breaks in prod, and you get an error const getBaseUrl = () => {
if (typeof window !== "undefined") return ""; // browser should use relative url
if (process.env.VERCEL_URL) return `https://${process.env.VERCEL_URL}`; // SSR should use vercel url
return `http://localhost:${process.env.PORT ?? 3000}`; // dev SSR should use localhost
}; During build time, and during SSR/ISR, tRPC is going to need to make a fetch request to your backend (i.e. your nextjs server) and it needs a url. If you're running serverless functions, you will need to pass in the url manually, but most of the time If you're running in Your error is in that function, play with it and you should be able to solve it. |
Beta Was this translation helpful? Give feedback.
-
When trying to build my Next.js project, I'm getting the following error:
My
withTRPC
config looks like this:This is the Next.js page that throws the error:
Thanks for looking into this!
Beta Was this translation helpful? Give feedback.
All reactions