Registry / api / apollo-fetch

apollo-fetch

JSON →
library0.7.0jsnpmunverified

A lightweight, minimalistic implementation of fetch specifically designed for GraphQL requests from the Apollo ecosystem. Version 0.7.0 (latest), not actively maintained—superseded by Apollo Client's built-in HTTP link. Provides a simple fetch-based interface for executing GraphQL queries and mutations. Unlike full Apollo Client, it offers no caching, state management, or React integration; purely a network layer. Ships TypeScript declarations. Low release cadence, no updates since 2018.

npm install apollo-fetch
INSTALL
IMPORT
SIG · APOLLO-FETCH
A
apollo-fetch
apijavascriptv0.7.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

createApolloFetch
import { createApolloFetch } from 'apollo-fetch'
import createApolloFetch from 'apollo-fetch'
Named export, not default.
ApolloFetch
import { ApolloFetch } from 'apollo-fetch'
const { ApolloFetch } = require('apollo-fetch')
Type import only for TypeScript.
(entire module)
const { createApolloFetch } = require('apollo-fetch')
const apolloFetch = require('apollo-fetch')
Named exports, not a default via CJS.

Creates an ApolloFetch instance and sends a simple GraphQL query using a URI from environment.

const { createApolloFetch } = require('apollo-fetch'); const fetch = createApolloFetch({ uri: process.env.GRAPHQL_URI ?? 'http://localhost:4000/graphql' }); fetch({ query: `{ __typename }` }).then(result => { console.log(result.data); }).catch(err => { console.error(err); });
Debug
Known issues
deprecatedApollo Fetch is deprecated in favor of Apollo Client's HttpLink.
fix
Migrate to @apollo/client and use createHttpLink.
affects: >=0.7.0
gotchaNo built-in support for subscriptions; only queries and mutations.
fix
Use Apollo Client for full subscription support.
affects: all
Errors
Common errors & fixes
TypeError: fetch is not a function
Missing fetch polyfill in Node.js or older browser.
fix
Install cross-fetch: npm install cross-fetch and add at top: require('cross-fetch/polyfill')
Uncaught (in promise) TypeError: Cannot destructure property 'data' of '(intermediate value)' as it is undefined.
GraphQL response contains errors or network failure; no data property.
fix
Check your network and graphql endpoint, handle errors properly: fetch({query}).then(({data, errors}) => { if (errors) console.error(errors); })
Upgrade
Version history
0.7.0latest on npm
Audit
Dependencies
cross-fetchoptionalpolyfills fetch for Node.js and older browsers
Agent activity
58 hits · last 30 days
node
52
OpenAI (training)
1
Resources
apollo-fetch — npm install apollo-fetch · libregistry