GraphQL Code Generator plugin for generating Apollo Client cache utilities and typed getServerSideProps in Next.js SSR. Current version 1.7.4, released 2022-05-12. Depends on graphql < 17.0.0. The plugin provides a typesafe getServerSideProps for each GraphQL query and a corresponding HOC to wrap the React component, avoiding multiple render passes required by getDataFromTree. The project is in maintenance mode and maintainer is needed; an alternative swr-gql solution is recommended. Key differentiator: it works with getServerSideProps (not getInitialProps) and generates cache read/write functions tailored for Apollo client integrations. Note: it uses the standard plugin configuration schema from graphql-codegen and outputs files with Apollo cache operations.
npm install graphql-codegen-apollo-next-ssrNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Configures graphql-codegen-apollo-next-ssr plugin in codegen.yml and uses generated getServerSideProps and HOC in a Next.js page.
Evaluate swr-gql (https://github.com/correttojs/swr-gql) as a replacement.
Ensure graphql version is <17.0.0 in package.json.
Set reactApolloVersion config to match your Apollo Client version (2 or 3).
Check generated output; if hooks not needed, set withHooks: false.
Use fully qualified imports or adjust tsconfig.
npm install graphql-codegen-apollo-next-ssr --save-dev and ensure plugins list uses exact package name.
Set apolloCacheImportFrom to '@apollo/client' when using Apollo Client v3.
Verify schema and document paths in codegen.yml; run graphql-codegen with verbose logging.
Install graphql@^16.0.0 (or compatible <17) in your project.