{"id":10507,"library":"apollo-graphql","title":"Apollo GraphQL Utility Library (Abandoned)","description":"The `apollo-graphql` package, last updated as version 0.9.7 around 2019, served as an internal utility library within the Apollo Server monorepo (primarily during the Apollo Server v2 era). It provided foundational GraphQL-related utilities for schema manipulation, such as adding resolvers, merging schemas, concatenating type definitions, and printing schemas with directives. This package is now considered abandoned, with no further updates planned, and its functionalities have been either integrated directly into newer versions of `@apollo/server` or are handled by more modern, actively maintained libraries like `@graphql-tools/schema` or `@apollo/server` itself. Developers are strongly advised not to use `apollo-graphql` for new projects due to its age, lack of updates, potential security vulnerabilities, and incompatibility with modern `graphql` and Node.js environments.","status":"abandoned","version":"0.9.7","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","typescript"],"install":[{"cmd":"npm install apollo-graphql","lang":"bash","label":"npm"},{"cmd":"yarn add apollo-graphql","lang":"bash","label":"yarn"},{"cmd":"pnpm add apollo-graphql","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for GraphQL schema and type definitions.","package":"graphql","optional":false}],"imports":[{"note":"This package predates widespread ESM adoption and primarily supports CommonJS `require()`. Named imports were available for CJS.","wrong":"import { addResolversToSchema } from 'apollo-graphql';","symbol":"addResolversToSchema","correct":"const { addResolversToSchema } = require('apollo-graphql');"},{"note":"Most exports were named. Default imports are not applicable for this package.","wrong":"import printSchemaWithDirectives from 'apollo-graphql';","symbol":"printSchemaWithDirectives","correct":"const { printSchemaWithDirectives } = require('apollo-graphql');"},{"note":"While `import * as` might technically work in some transpiled environments, the intended and most reliable import pattern for this legacy package is CommonJS `require()`.","wrong":"import * as ApolloGraphql from 'apollo-graphql';","symbol":"mergeSchemas","correct":"const { mergeSchemas } = require('apollo-graphql');"}],"quickstart":{"code":"const { gql } = require('apollo-server-express');\nconst { addResolversToSchema } = require('apollo-graphql');\nconst { makeExecutableSchema } = require('@graphql-tools/schema');\n\n// This example is for illustrative purposes only, showing historical usage.\n// It is not recommended for current development.\n\nconst typeDefs = gql`\n  type Query {\n    hello: String\n    greet(name: String!): String\n  }\n`;\n\nconst resolvers = {\n  Query: {\n    hello: () => 'Hello, world!',\n    greet: (parent, { name }) => `Greetings, ${name}!`, \n  },\n};\n\n// Create a basic executable schema (using modern @graphql-tools for simplicity here)\nlet schema = makeExecutableSchema({ typeDefs });\n\n// Historically, apollo-graphql's addResolversToSchema would be used.\n// Note: This function might not be directly compatible with modern `graphql-tools` Schema types.\n// For a truly historical setup, one would need older `graphql` and `graphql-tools` versions.\ntry {\n  schema = addResolversToSchema(schema, resolvers);\n  console.log('Schema with resolvers added (historical emulation):');\n  // In a real scenario, you'd then pass this schema to Apollo Server v2\n  // For demonstration, we'll just log a success message.\n  console.log('Schema successfully augmented using addResolversToSchema.');\n  console.log(require('graphql').printSchema(schema));\n} catch (e) {\n  console.error('Error attempting to use addResolversToSchema. This package is old and likely incompatible:', e.message);\n}\n\n// For current projects, use `@apollo/server` or `@graphql-tools/schema` directly.\n","lang":"javascript","description":"Illustrates the historical usage of `addResolversToSchema` from `apollo-graphql` within a CommonJS environment, emphasizing its abandonment and suggesting modern alternatives."},"warnings":[{"fix":"Do not use this package. Migrate to `@apollo/server`, `@apollo/client`, or `@graphql-tools/schema` for equivalent functionalities.","message":"This package is explicitly abandoned and has not received updates since approximately 2019. It is not compatible with modern Node.js versions (e.g., Node.js 14+ ESM), current `graphql` library versions (v16+), or the latest `@apollo/server` releases.","severity":"breaking","affected_versions":">=1.0.0 (no version 1.0 exists)"},{"fix":"Ensure you are using `require()` for all imports from `apollo-graphql` in your JavaScript files. For TypeScript, ensure your `tsconfig.json`'s `module` option is set to `CommonJS` or that your bundler handles legacy CJS modules correctly.","message":"The package primarily targets CommonJS environments. Attempting to use `import` statements directly will likely result in module resolution errors or runtime failures unless a robust transpilation pipeline (e.g., Babel, Webpack) is specifically configured for such legacy modules.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Remove this package from your dependencies and replace its functionality with modern, actively maintained libraries from the Apollo ecosystem or `graphql-tools`.","message":"Security vulnerabilities are highly probable due to the package's age and lack of maintenance. Any reported CVEs or discovered weaknesses will not be patched, posing significant risks to applications that still depend on it.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"If absolutely forced to use this package (not recommended), pin your `graphql` dependency to a compatible version (e.g., `^15.0.0`). The ultimate fix is to migrate away from `apollo-graphql`.","message":"The peer dependency on `graphql` specifies versions `^14.2.1 || ^15.0.0`. Installing this package with `graphql` v16 or higher will trigger peer dependency warnings and likely lead to runtime errors due to API changes in the `graphql` library itself.","severity":"gotcha","affected_versions":">=0.9.7"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Change your import statement to use CommonJS `require()`: `const { addResolversToSchema } = require('apollo-graphql');`.","cause":"Attempting to import `apollo-graphql` using ESM `import` syntax in an environment that doesn't correctly transpile legacy CommonJS modules, or when the `addResolversToSchema` function is not correctly resolved.","error":"TypeError: (0 , apollo_graphql_1.addResolversToSchema) is not a function"},{"fix":"Ensure the package is installed: `npm install apollo-graphql` or `yarn add apollo-graphql`. Also, verify that your project's module resolution paths are correctly configured.","cause":"The package `apollo-graphql` is not installed, or your module resolver (e.g., Webpack, Node.js) cannot locate it. This often happens if the package name is misspelled, or if it's not present in `node_modules`.","error":"Cannot find module 'apollo-graphql'"},{"fix":"Install a compatible version of `graphql`, for example: `npm install graphql@^15.0.0`. However, the primary recommendation is to remove `apollo-graphql` entirely due to its abandonment.","cause":"You have a version of `graphql` installed that is outside the range specified by `apollo-graphql`'s peer dependencies, or `graphql` is not installed at all.","error":"npm WARN apollo-graphql@0.9.7 requires a peer of graphql@^14.2.1 || ^15.0.0 but none is installed."}],"ecosystem":"npm"}