Skip to content

chore(core/api): upgrade @apollo/server v4→v5, add @as-integrations/express4#509

Open
k9ert wants to merge 1 commit intomainfrom
kn/upgrade-apollo-server-core-api
Open

chore(core/api): upgrade @apollo/server v4→v5, add @as-integrations/express4#509
k9ert wants to merge 1 commit intomainfrom
kn/upgrade-apollo-server-core-api

Conversation

@k9ert
Copy link
Copy Markdown

@k9ert k9ert commented Mar 25, 2026

Summary

Upgrades Apollo Server in core/api from v4 (EOL) to v5:

  • @apollo/server: ^4.12.2^5.0.0 (resolved: 5.5.0)
  • NEW @as-integrations/express4: ^1.0.0 (resolved: 1.1.2) — replaces @apollo/server/express4 subpath

Motivation: Apollo Server v4 is End of Life. Tracked in blinkbitcoin/blink-wip#634 (parent: blinkbitcoin/blink-wip#631).

What changed

core/api/package.json

  • Bumped @apollo/server from ^4.12.2 to ^5.0.0
  • Added @as-integrations/express4 as new dependency

core/api/src/servers/graphql-server.ts

One import change:

-import { expressMiddleware } from "@apollo/server/express4"
+import { expressMiddleware } from "@as-integrations/express4"

This is the only code change. The expressMiddleware function has the same API — only the package location moved.

pnpm-lock.yaml

Lockfile update.

Breaking changes reviewed (Apollo Server v4 → v5)

Full migration guide: https://www.apollographql.com/docs/apollo-server/migration/

Breaking change Impact on core/api Action
Node.js ≥ v20 required package.json already specifies "node": "20" None
graphql.js ≥ v16.11.0 required Currently ^16.11.0 — satisfies None
Express integration extracted to @as-integrations/express4 This is the main change. expressMiddleware import moved from @apollo/server/express4 to @as-integrations/express4. Same API, same function signature Import updated
status400ForVariableCoercionErrors now defaults to true Variable coercion errors now return HTTP 400 instead of 200. Correct per GraphQL spec None (improvement)
cache: "bounded" constructor option Still supported in v5, no change needed None
formatError callback API unchanged. Our custom formatError with unwrapResolverError works as-is. unwrapResolverError still exported from @apollo/server/errors None
ApolloServerPluginDrainHttpServer Still at @apollo/server/plugin/drainHttpServer, unchanged None
ApolloServer constructor + ApolloServerPlugin type Still exported from @apollo/server, unchanged None
startStandaloneServer no longer uses Express Not used in core/api (uses explicit Express setup) N/A
precomputedNonce option removed Not used N/A
Native fetch instead of node-fetch No HTTP proxy usage N/A
Compiled targeting ES2023 Fine for Node.js 20 None

Subpath exports verified in @apollo/server v5

The following subpath imports used by core/api are all still present in v5:

  • @apollo/serverApolloServer, ApolloServerPlugin
  • @apollo/server/errorsunwrapResolverError
  • @apollo/server/plugin/drainHttpServerApolloServerPluginDrainHttpServer
  • @apollo/server/express4removed, replaced by @as-integrations/express4 ✅ (updated)

@as-integrations/express4

Verification

  • pnpm install --filter api — clean install ✅
  • tsc --noEmit — zero Apollo-related type errors ✅

Closes blinkbitcoin/blink-wip#634

🤖 Generated with Claude Code

…xpress4

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant