Registry / http-networking / http-link-dataloader

http-link-dataloader

JSON →
library0.1.6jsnpmunverified

http-link-dataloader is an Apollo Link designed to provide efficient HTTP requests for GraphQL by leveraging Facebook's DataLoader for automatic batching and caching. It distinguishes itself from `apollo-link-batch-http` by using an event-loop-based batching mechanism, consolidating consecutive GraphQL queries into a single HTTP request payload. The package currently sits at version 0.1.6, with its last release in 2018, indicating a lack of active development or a very slow release cadence. It was primarily developed for use cases involving `graphql-yoga` servers and `prisma-binding` (now largely deprecated in favor of Prisma Client), supporting array-based GraphQL batching on the server side. It ships with TypeScript types, but its age raises significant compatibility concerns with modern Apollo Client (v3+) and GraphQL ecosystems.

npm install http-link-dataloader
INSTALL
IMPORT
SIG · HTTP-LINK-DATALOAD
H
http-link-dataloader
http-networkingjavascriptv0.1.6
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.

HTTPLinkDataloader
import { HTTPLinkDataloader } from 'http-link-dataloader'
const HTTPLinkDataloader = require('http-link-dataloader')
The package ships with TypeScript types and is intended for ES module environments.

Demonstrates how to import and instantiate the `HTTPLinkDataloader` with basic and authenticated configurations, and integrate it into an Apollo Client instance for querying.

import { ApolloClient, InMemoryCache } from '@apollo/client'; import { HTTPLinkDataloader } from 'http-link-dataloader'; // Basic instantiation without options const basicLink = new HTTPLinkDataloader(); // Instantiation with URI and headers const token = process.env.AUTH_TOKEN ?? ''; // Securely get your auth token const httpLink = new HTTPLinkDataloader({ uri: `https://your-graphql-api.com/graphql`, headers: { Authorization: `Bearer ${token}` }, }); // Example of setting up an Apollo Client with the dataloader link // Note: This package might not be compatible with modern Apollo Client versions (v3+). // This example assumes compatibility or a legacy Apollo Client setup. const client = new ApolloClient({ link: httpLink, cache: new InMemoryCache(), }); // Example query using the client (requires your GraphQL schema) async function fetchData() { try { const { data } = await client.query({ query: ` query GetItems { items { id name } } `, }); console.log('Fetched data:', data); } catch (error) { console.error('Error fetching data:', error); } } fetchData();
Debug
Known issues
breakingThe package was last updated in 2018 for GraphQL 14 support. It is highly likely to be incompatible with newer versions of Apollo Client (v3+) and GraphQL (v15+) due to significant changes in their ecosystems.
fix
Consider using alternative, actively maintained Apollo Link implementations for batching (e.g., `apollo-link-batch-http` or `apollo-link-batch`) or modern `dataloader` patterns within resolvers. If absolutely necessary, pin `apollo-client` and `graphql` dependencies to versions compatible with 2018 releases.
affects: <=0.1.6
gotchaDataLoader aggressively caches results within its instance. For server environments, a new instance of `HTTPLinkDataloader` should be created for every incoming HTTP request to prevent caching data across different client requests or authenticated scopes, which could lead to data leakage or stale data.
fix
Always instantiate `HTTPLinkDataloader` (or `BatchedHTTPLink` as mentioned in the README) within the context of a single request, ensuring a fresh cache for each client operation. For example, in a `graphql-yoga` context function.
affects: >=0.1.0
gotchaThe library uses array-based batching, meaning the GraphQL server needs explicit support for receiving and processing an array of GraphQL queries in a single HTTP request. Many modern GraphQL servers do not support this out-of-the-box or have deprecated it in favor of alternative batching strategies.
fix
Verify that your GraphQL server explicitly supports array-based batching. If not, consider server-side alias-based batching or alternative client-side batching links.
affects: >=0.1.0
deprecatedThe package appears abandoned, with the last publish over seven years ago (as of April 2026). This means there will be no further updates for bug fixes, security vulnerabilities, or compatibility with newer dependencies and language features.
fix
Migrate to a more actively maintained Apollo Link or a custom DataLoader implementation if batching and caching are required. Evaluate potential security risks from unpatched transitive dependencies.
affects: >=0.1.0
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'request')
Incompatibility with newer versions of Apollo Client's `ApolloLink` interface or `graphql` package's `execute` function due to breaking changes since 2018.
fix
Upgrade Apollo Client and related `apollo-link` packages to a modern, compatible version (v3+), and migrate away from `http-link-dataloader` to a current solution for batching and caching. Alternatively, downgrade Apollo Client and GraphQL dependencies to versions compatible with `http-link-dataloader`'s last release (e.g., Apollo Client 2.x and GraphQL 14).
Error: GraphQL error: Response not successful: Received status code 400
The GraphQL server does not support the array-based batching format sent by `http-link-dataloader`, leading to a malformed request error.
fix
Configure your GraphQL server to accept and process an array of GraphQL operations. If server-side support is not feasible, switch to an Apollo Link that uses a different batching strategy or disables batching entirely.
Unexpected data being returned or stale data in subsequent requests
The DataLoader's cache is persisting across multiple client requests in a shared server environment, leading to data from one client being returned to another or old data not being refreshed.
fix
Ensure that a *new* instance of `HTTPLinkDataloader` is created for *each* incoming GraphQL request on the server. For example, if using `graphql-yoga` or `ApolloServer`, instantiate the link within the `context` function.
Upgrade
Version history
0.1.6latest on npm
Audit
Dependencies
dataloaderrequiredCore technology for batching and caching GraphQL requests.
apollo-linkrequiredProvides the Apollo Link interface that this package implements. Compatibility with newer `apollo-link` versions (beyond v1.x) is uncertain due to the package's age.
graphqlrequiredSupports GraphQL schema processing and query handling up to version 14. Newer GraphQL versions might not be compatible.
Agent activity
4 hits · last 30 days
node
4
Resources