Registry / http-networking / apollo-angular-link-http

apollo-angular-link-http

JSON →
library1.11.0jsnpmunverified

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.

npm install apollo-angular-link-http
INSTALL
IMPORT
SIG · APOLLO-ANGULAR-LIN
A
apollo-angular-link-http
http-networkingjavascriptv1.11.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

HttpLinkModule
import { HttpLinkModule } from 'apollo-angular-link-http';
import { HttpLinkModule } from 'apollo-angular';
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.
HttpLink
import { HttpLink } from 'apollo-angular-link-http';
const HttpLink = require('apollo-angular-link-http');
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()`.
HttpHeaders
import { HttpHeaders } from '@angular/common/http';
Used for setting custom HTTP headers on requests. This is an Angular core import, not from apollo-angular-link-http.

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.

import { NgModule } from '@angular/core'; import { HttpClientModule, HttpHeaders } from '@angular/common/http'; import { ApolloModule, Apollo } from 'apollo-angular'; import { HttpLinkModule, HttpLink } from 'apollo-angular-link-http'; import { InMemoryCache } from '@apollo/client/core'; // From @apollo/client import { gql } from 'graphql-tag'; // For defining GraphQL queries const MY_QUERY = gql` query MyQuery($id: ID!) { item(id: $id) { name description } } `; @NgModule({ imports: [HttpClientModule, ApolloModule, HttpLinkModule], // ... other module configurations }) class AppModule { constructor(apollo: Apollo, httpLink: HttpLink) { apollo.create({ link: httpLink.create({ uri: '/graphql', includeExtensions: false, headers: new HttpHeaders().set('Authorization', 'Bearer ' + (process.env.AUTH_TOKEN ?? '')), }), cache: new InMemoryCache(), }); // Example of executing a query with context apollo.query({ query: MY_QUERY, variables: { id: '123' }, context: { headers: new HttpHeaders().set('X-Custom-Header', 'custom-value'), }, }).subscribe({ next: ({ data, loading }) => { console.log('Query data:', data); console.log('Loading:', loading); }, error: (error) => { console.error('Query error:', error); } }); } }
Debug
Known issues
breakingThe `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.
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.
affects: >=1.0.0
breakingThis 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.
fix
Upgrade to `apollo-angular` (v10+), which supports a wider range of Angular versions, and remove `apollo-angular-link-http` from your dependencies.
affects: >=1.0.0
breakingMajor 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.
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.
affects: >=1.0.0
gotchaThe `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.
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.
affects: >=1.0.0
Errors
Common errors & fixes
Module not found: Can't resolve 'apollo-angular-link-http'
The package `apollo-angular-link-http` is not installed or the import path is incorrect.
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`.
Error: NG0201: No provider for HttpLink!
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()`.
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()`.
Argument of type 'object' is not assignable to parameter of type 'HttpHeaders'.
When setting `headers` in `HttpLink.create()` or `context`, a plain JavaScript object was provided instead of an `HttpHeaders` instance.
fix
Always construct `HttpHeaders` using `new HttpHeaders()` from `@angular/common/http`: `new HttpHeaders().set('Key', 'Value')`.
Upgrade
Version history
1.11.0latest on npm
Audit
Dependencies
@angular/corerequiredRequired for core Angular functionality and dependency injection.
@angular/commonrequiredSpecifically for `HttpClient` which this link relies on for network requests.
apollo-linkrequiredProvides the base `ApolloLink` interface and utilities.
graphqlrequiredRequired for parsing GraphQL documents.
Agent activity
20 hits · last 30 days
node
18
Amazon
1
OpenAI (training)
1
Resources
apollo-angular-link-http — npm install apollo-angular-link-http · libregistry