prefetchInfinite on getServerSideProps using SSG helpers

I'm trying to implement pagination using infiniteQuery and SSR with trpc: -

export const getServerSideProps = async () => {
  const ssg = generateSSGHelper();

  await ssg.posts.getAll.prefetchInfinite({ limit: 4 });

  return {
    props: {
      trpcState: ssg.dehydrate(),
    },
  };
};


export function generateSSGHelper() {

  return createProxySSGHelpers({
    router: appRouter,
    ctx: { prisma, session: null },
    transformer: superjson
  });
}


getAll: publicProcedure
    .input(z.object({
      limit: z.number(),
      cursor: z.string().nullish(),
      skip: z.number().optional(),
    }))
    .query(async ({ ctx, input }) => {
      const { limit, skip, cursor } = input;

      const posts = await ctx.prisma.post.findMany({
        take: limit + 1,
        skip: skip,
        cursor: cursor ? { id: cursor } : undefined,
        orderBy: {
          createdAt: "desc"
        },
      });

      let nextCursor: typeof cursor | undefined = undefined;
      if (posts.length > limit) {
        const nextItem = posts.pop();
        nextCursor = nextItem?.id;
      }

      return {
        posts,
        nextCursor
      };
    }),


getting the error in the picture, I followed christopher ehrlich's video
Screenshot_2023-04-02_123922.png
Was this page helpful?