tRPCttRPC
Powered by
DelvisD
tRPC•4y ago
Delvis

SSG on nextJS when appRouter is made with fastify adapter?

export const getStaticProps: GetStaticProps = async () => {
  const ssg = await createSSGHelpers({
    router: appRouter //This app router is in fastify
    ctx: await createContext(),
  });

  await ssg.fetchQuery("personalStats");
  await ssg.fetchQuery("ageOfOnsetPsychosisByGender");
  await ssg.fetchQuery("PsyLengthByGender");

  return {
    props: {
      trpcState: ssg.dehydrate(),
    },
    revalidate: 1,
  };
};
export const getStaticProps: GetStaticProps = async () => {
  const ssg = await createSSGHelpers({
    router: appRouter //This app router is in fastify
    ctx: await createContext(),
  });

  await ssg.fetchQuery("personalStats");
  await ssg.fetchQuery("ageOfOnsetPsychosisByGender");
  await ssg.fetchQuery("PsyLengthByGender");

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


Anybody used next SSG with fastify adapter? If try to import appRouter from fastify to getStaticProps router in nextjs, I get webpack loader problems. How should I approach getting this to work?
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Throwing fastify errors when using fastify adapter
rdRrd / ❓-help
3y ago
Error on NextJs AppRouter
sudoSsudo / ❓-help
2y ago
Route not found when using Fastify adapter
TeixeiraTTeixeira / ❓-help
13mo ago