{"id":14429,"library":"apollo-language-server","title":"Apollo Language Server","description":"The Apollo Language Server is a deprecated JavaScript/TypeScript package designed to provide advanced language features for Apollo GraphQL projects within integrated development environments (IDEs). Last actively maintained at version 1.26.9 and published approximately four years ago, it aimed to offer capabilities such as syntax highlighting, real-time validation, autocompletion, and schema navigation for GraphQL files and embedded GraphQL templates. Its core functionality has since been integrated directly into the official Apollo GraphQL VS Code extension and other Apollo tooling, rendering this standalone package largely obsolete for modern development. As such, it is no longer actively developed or recommended for new projects, with its primary function superseded by a more integrated editor experience. Developers should utilize the VS Code extension for current Apollo GraphQL language support.","status":"deprecated","version":"1.26.9","language":"javascript","source_language":"en","source_url":"https://github.com/apollographql/apollo-tooling","tags":["javascript","typescript"],"install":[{"cmd":"npm install apollo-language-server","lang":"bash","label":"npm"},{"cmd":"yarn add apollo-language-server","lang":"bash","label":"yarn"},{"cmd":"pnpm add apollo-language-server","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core dependency for implementing the Language Server Protocol.","package":"vscode-languageserver","optional":false},{"reason":"Fundamental dependency for GraphQL schema parsing and validation.","package":"graphql","optional":false},{"reason":"Used for loading configuration files from various sources.","package":"cosmiconfig","optional":false}],"imports":[{"note":"This package is an implementation of a Language Server, meant to be executed as a process (e.g., `node ./node_modules/apollo-language-server/lib/index.js`) and communicate via the Language Server Protocol. It does not expose symbols for direct programmatic import into typical application code.","symbol":"Not applicable for direct application import","correct":"// The apollo-language-server package is designed to be run as a standalone process\n// and communicates via the Language Server Protocol (LSP) over stdin/stdout.\n// It is not typically imported as a library into other JavaScript/TypeScript applications.\n// Instead, editor extensions (like the Apollo GraphQL VS Code extension) invoke it as a child process."}],"quickstart":{"code":"/*\nThis quickstart demonstrates how a Language Server Protocol (LSP) client, \nsuch as an IDE extension, might theoretically invoke the apollo-language-server \nas a child process. \n\nDirect programmatic use of this package in a typical application is not intended \nor recommended, especially given its deprecated status.\n\nUsers seeking Apollo GraphQL language features should install the official \n'Apollo GraphQL' VS Code extension or similar editor integrations.\n*/\n\nimport { spawn } from 'child_process';\nimport path from 'path';\n\nconst languageServerPath = path.resolve(\n  __dirname, \n  'node_modules', \n  'apollo-language-server', \n  'lib', \n  'index.js'\n);\n\nconst languageServerProcess = spawn(\n  'node',\n  [languageServerPath],\n  { stdio: ['pipe', 'pipe', 'pipe'] }\n);\n\nlanguageServerProcess.stdout.on('data', (data) => {\n  console.log(`LSP Server stdout: ${data}`);\n  // In a real LSP client, this data would be parsed as LSP messages\n  // and used to update editor features (diagnostics, completions, etc.)\n});\n\nlanguageServerProcess.stderr.on('data', (data) => {\n  console.error(`LSP Server stderr: ${data}`);\n});\n\nlanguageServerProcess.on('close', (code) => {\n  console.log(`LSP Server process exited with code ${code}`);\n});\n\n// Example: Sending an initialize request (simplified, actual LSP has headers)\nconst initializeRequest = {\n  jsonrpc: '2.0',\n  id: 1,\n  method: 'initialize',\n  params: {\n    processId: process.pid,\n    rootUri: `file://${process.cwd()}`,\n    capabilities: { /* client capabilities here */ }\n  }\n};\n\nfunction sendLSPMessage(message: any) {\n  const content = JSON.stringify(message);\n  const contentLength = Buffer.byteLength(content, 'utf8');\n  const header = `Content-Length: ${contentLength}\\r\\nContent-Type: application/json\\r\\n\\r\\n`;\n  languageServerProcess.stdin.write(header + content);\n}\n\n// In a real client, you'd send more messages (didOpen, didChange, etc.)\n// For this quickstart, we'll just demonstrate starting and sending one message.\n// In a real scenario, there would be a full LSP communication loop.\n\n// To prevent the example from hanging indefinitely in a CI environment\nsetTimeout(() => {\n  console.log('Terminating example LSP client after some time.');\n  languageServerProcess.kill();\n}, 5000);\n","lang":"typescript","description":"This quickstart illustrates how a host application or editor extension might start and communicate with the Apollo Language Server as an external process using the Language Server Protocol (LSP). It simulates sending an 'initialize' request, which is the first message an LSP client sends to a server. This package is not designed for direct application imports, as its functionality is consumed by editor extensions."},"warnings":[{"fix":"Migrate to the official 'Apollo GraphQL' VS Code extension (or corresponding IDE integration) for current GraphQL language features and support. If programmatic GraphQL tooling is required, explore `@apollo/server` for server implementations or `@graphql-tools/*` for schema utilities.","message":"The `apollo-language-server` package is deprecated and no longer actively maintained. Its functionality has been integrated into the 'Apollo GraphQL' VS Code extension and other Apollo tooling. New projects should not rely on this package directly.","severity":"breaking","affected_versions":">=1.26.9"},{"fix":"Do not attempt to `import` and use symbols from `apollo-language-server` in your application. Instead, install the Apollo GraphQL VS Code extension or understand that your IDE uses a bundled or separately installed language server process.","message":"This package is an implementation of a Language Server and is intended to be run as a separate process (e.g., by an editor extension) communicating via stdin/stdout using the Language Server Protocol. It is not designed to be imported as a library for direct programmatic use within application code.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure you are using the latest available version (1.26.9), though active maintenance has ceased. For optimal performance and features, use the actively developed Apollo GraphQL VS Code extension which incorporates more recent optimizations and updated tooling.","message":"Older versions of the Apollo Language Server, particularly when dealing with large or complex GraphQL projects, have been reported to exhibit slow performance for features like 'Go to Definition' or general IntelliSense suggestions, especially on Windows.","severity":"gotcha","affected_versions":"<1.26.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure `apollo-language-server` is installed in your project's `node_modules`. If you are trying to use it programmatically as a library, reconsider your approach; it is designed as a standalone process. For editor features, install the Apollo GraphQL VS Code extension.","cause":"The language server is typically invoked as a child process by an editor extension, not directly imported. This error may occur if an LSP client attempts to load the module incorrectly or if the package is not correctly installed.","error":"Cannot find module 'apollo-language-server/lib/index.js'"},{"fix":"Restart VS Code. If the issue persists, try clearing the VS Code cache, ensuring your `apollo.config.js` or `apollo.config.json` file is correctly configured at your project root, and checking the VS Code output panel for 'Apollo GraphQL' for more specific error messages. Ensure your Node.js version meets the `engines` requirement (>=8).","cause":"This error typically indicates that the language server process failed to start or crashed, which is often managed by the VS Code extension. It can be due to corrupted caches, misconfigurations, or conflicts.","error":"Error: GraphQL service is not running. Please restart VS Code."}],"ecosystem":"npm"}