Anyone have Prisma working with Apollo in Next.js ...
# orm-help
j
Anyone have Prisma working with Apollo in Next.js SSR/SSG?
r
@Jake Quinter 👋 Apollo server you mean?
j
Yeah, Apollo server sorry.
d
I don’t personally use Apollo, only host my db in a docker postgres container and SSR/SSG APIs in nextjs work great.
r
We do have one here in our examples repo.
j
Yeah, I’ve looked at a couple different examples Prisma has. I think I have the setup correct, but seeming to get ‘Cannot read property prisma’ in SSR
It seems the commented out code doesn’t know what Prisma is and just not sure why.
Copy code
export const getServerSideProps = async () => {
  const apolloClient = initializeApollo();

  // await apolloClient.query({
  //   query: GET_USERS_QUERY,
  // });

  return {
    props: {
      initialApolloState: apolloClient.cache.extract(),
    },
  };
};
Works fine using Apollo’s useQuery hook, so not sure why it would recognize prisma there, but not server side