{"id":17159,"library":"apollo-angular-link-http","title":"Apollo Angular HTTP Link","description":"apollo-angular-link-http is an Apollo Link implementation designed for Angular applications to facilitate sending GraphQL operations over standard HTTP requests. This package leverages Angular's `HttpClient` (`@angular/common/http`) for network communication. While its last stable version, `1.11.0`, was released over three years ago, its core functionality for creating an HTTP link has largely been integrated and superseded by the primary `apollo-angular` package. As such, `apollo-angular-link-http` is now considered abandoned. Modern Angular and Apollo setups typically configure `HttpLink` directly through `apollo-angular`'s `ApolloClient` creation process, often utilizing `provideApollo()` for dependency injection. This package previously served as a distinct module for HTTP-based GraphQL communication before the `apollo-angular` ecosystem evolved to incorporate this functionality directly.","status":"abandoned","version":"1.11.0","language":"javascript","source_language":"en","source_url":"https://github.com/kamilkisiela/apollo-angular","tags":["javascript","apollo","graphql","angular","typescript"],"install":[{"cmd":"npm install apollo-angular-link-http","lang":"bash","label":"npm"},{"cmd":"yarn add apollo-angular-link-http","lang":"bash","label":"yarn"},{"cmd":"pnpm add apollo-angular-link-http","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for core Angular functionality and dependency injection.","package":"@angular/core","optional":false},{"reason":"Specifically for `HttpClient` which this link relies on for network requests.","package":"@angular/common","optional":false},{"reason":"Provides the base `ApolloLink` interface and utilities.","package":"apollo-link","optional":false},{"reason":"Required for parsing GraphQL documents.","package":"graphql","optional":false}],"imports":[{"note":"This module is specific to the `apollo-angular-link-http` package. Modern `apollo-angular` setups (v10+) use `provideApollo()` instead of modules for configuration, often importing `HttpLink` from `apollo-angular/http` directly.","wrong":"import { HttpLinkModule } from 'apollo-angular';","symbol":"HttpLinkModule","correct":"import { HttpLinkModule } from 'apollo-angular-link-http';"},{"note":"While `HttpLink` is available from this package, for `apollo-angular` v10+, it's typically imported as `HttpLink` from `apollo-angular/http` and provided via `provideApollo()` or used in `Apollo.create()`.","wrong":"const HttpLink = require('apollo-angular-link-http');","symbol":"HttpLink","correct":"import { HttpLink } from 'apollo-angular-link-http';"},{"note":"Used for setting custom HTTP headers on requests. This is an Angular core import, not from apollo-angular-link-http.","symbol":"HttpHeaders","correct":"import { HttpHeaders } from '@angular/common/http';"}],"quickstart":{"code":"import { NgModule } from '@angular/core';\nimport { HttpClientModule, HttpHeaders } from '@angular/common/http';\nimport { ApolloModule, Apollo } from 'apollo-angular';\nimport { HttpLinkModule, HttpLink } from 'apollo-angular-link-http';\nimport { InMemoryCache } from '@apollo/client/core'; // From @apollo/client\nimport { gql } from 'graphql-tag'; // For defining GraphQL queries\n\nconst MY_QUERY = gql`\n  query MyQuery($id: ID!) {\n    item(id: $id) {\n      name\n      description\n    }\n  }\n`;\n\n@NgModule({\n  imports: [HttpClientModule, ApolloModule, HttpLinkModule],\n  // ... other module configurations\n})\nclass AppModule {\n  constructor(apollo: Apollo, httpLink: HttpLink) {\n    apollo.create({\n      link: httpLink.create({\n        uri: '/graphql',\n        includeExtensions: false,\n        headers: new HttpHeaders().set('Authorization', 'Bearer ' + (process.env.AUTH_TOKEN ?? '')),\n      }),\n      cache: new InMemoryCache(),\n    });\n\n    // Example of executing a query with context\n    apollo.query({\n      query: MY_QUERY,\n      variables: { id: '123' },\n      context: {\n        headers: new HttpHeaders().set('X-Custom-Header', 'custom-value'),\n      },\n    }).subscribe({\n      next: ({ data, loading }) => {\n        console.log('Query data:', data);\n        console.log('Loading:', loading);\n      },\n      error: (error) => {\n        console.error('Query error:', error);\n      }\n    });\n  }\n}","lang":"typescript","description":"Demonstrates setting up `apollo-angular-link-http` in an Angular `NgModule`, configuring `HttpLink` with a URI and headers, and executing a simple GraphQL query with operation-specific context. Note that this setup relies on older Angular module patterns."},"warnings":[{"fix":"Migrate to `apollo-angular` (e.g., v10+) and use `HttpLink` from `apollo-angular/http`. Configure Apollo Client using `provideApollo()` in standalone components or `app.config.ts` for newer Angular applications, or `Apollo.create()` directly in `AppModule` for older setups.","message":"The `apollo-angular-link-http` package is effectively abandoned and its functionality has been superseded. Its last publish was over three years ago (v1.11.0). Users should migrate to the main `apollo-angular` package, which now includes its own `HttpLink` implementation and provides modern setup options like `provideApollo()` for Angular applications.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Upgrade to `apollo-angular` (v10+), which supports a wider range of Angular versions, and remove `apollo-angular-link-http` from your dependencies.","message":"This package's peer dependency for `@angular/core` is limited to `^6.0.0 || ... || ^10.0.0`. It is not compatible with Angular versions 11 and above, which are now widely used. Attempting to use it with newer Angular versions will lead to peer dependency resolution errors.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Follow the migration guides for `apollo-angular` and `@apollo/client` when upgrading. Remove this deprecated link package and use the `HttpLink` provided by `apollo-angular` itself.","message":"Major versions of `apollo-angular` (e.g., v10, v12, v13) have introduced significant breaking changes, including dropping `ApolloModule` in favor of `provideApollo()`, requiring `@apollo/client` v4 migration, and dropping support for older Angular versions. These changes make `apollo-angular-link-http` incompatible with modern `apollo-angular` setups.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Ensure your `graphql` dependency aligns with the requirements of `@apollo/client` and `apollo-angular`. If using modern `apollo-angular`, this package should be removed to avoid conflicts.","message":"The `graphql` peer dependency is very specific (`>=0.11.0 <0.14.0 || ^14.0.0 || ^15.0.0`). Newer versions of `@apollo/client` might require `graphql@^16` or `^17`, leading to potential version conflicts if this package is retained.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"Ensure the package is installed via `npm install apollo-angular-link-http` or `yarn add apollo-angular-link-http`, and verify the import statement. For modern Angular setups, consider migrating to `apollo-angular`'s built-in `HttpLink`.","cause":"The package `apollo-angular-link-http` is not installed or the import path is incorrect.","error":"Module not found: Can't resolve 'apollo-angular-link-http'"},{"fix":"If using this package, ensure `HttpLinkModule` is in your `imports` array of the relevant `NgModule`. If using `apollo-angular` v10+, consider replacing `HttpLinkModule` with `HttpLink` from `apollo-angular/http` and configuring it via `provideApollo()`.","cause":"The `HttpLinkModule` was not imported into your Angular `NgModule`, or you are using an older module-based setup with a newer Apollo Angular version that expects `provideApollo()`.","error":"Error: NG0201: No provider for HttpLink!"},{"fix":"Always construct `HttpHeaders` using `new HttpHeaders()` from `@angular/common/http`: `new HttpHeaders().set('Key', 'Value')`.","cause":"When setting `headers` in `HttpLink.create()` or `context`, a plain JavaScript object was provided instead of an `HttpHeaders` instance.","error":"Argument of type 'object' is not assignable to parameter of type 'HttpHeaders'."}],"ecosystem":"npm","meta_description":null}