Router Troubleshooting
Common issues and solutions when running Apollo Router.
Startup Issues
Router Fails to Start
Error: No supergraph schema provided
Error: No supergraph schema found. Provide --supergraph or set APOLLO_GRAPH_REF.Fix: Provide a supergraph schema:
# Local file
router --supergraph ./supergraph.graphql
# Or GraphOS managed
export APOLLO_KEY=service:my-graph:key
export APOLLO_GRAPH_REF=my-graph@production
routerError: Invalid configuration
Error: configuration error: unknown field `cors`Fix: Check YAML syntax and field names:
# Validate config
router config validate router.yamlPort Already in Use
Error: Address already in use (os error 48)Fix: Use a different port or stop the existing process:
# Check what's using the port
lsof -i :4000
# Use different port
router --supergraph ./supergraph.graphql --listen 127.0.0.1:4001Connection Issues
Cannot Connect to Subgraphs
Error: Connection refused
Error: error sending request for url (http://localhost:4001/graphql): error trying to connectChecklist:
- Verify subgraph is running:
curl -X POST http://localhost:4001/graphql -H "Content-Type: application/json" -d '{"query":"{ __typename }"}' - Check URL in supergraph schema is correct
- For Docker, use host.docker.internal or service names
Override subgraph URL for local development:
# router.yaml
override_subgraph_url:
products: http://host.docker.internal:4001/graphqlError: Timeout
Error: operation timed outIncrease timeout:
traffic_shaping:
subgraphs:
slow-service:
timeout: 60sGraphOS Connection Issues
Error: Failed to fetch schema from Uplink
Error: failed to fetch schema: Uplink request failedChecklist:
- Verify
APOLLO_KEYis correct - Verify
APOLLO_GRAPH_REFformat:graph-id@variant - Check network connectivity to Apollo
# Test connection
curl -H "X-Api-Key: $APOLLO_KEY" \
https://uplink.api.apollographql.com/Query Issues
Introspection Not Working
Error: Introspection disabled
{
"errors": [{ "message": "Introspection has been disabled" }]
}Fix: Enable introspection (development only):
supergraph:
introspection: trueOr use --dev mode:
router --dev --supergraph ./supergraph.graphqlSandbox Not Loading
Sandbox requires introspection. Enable both:
supergraph:
introspection: true
sandbox:
enabled: trueOr use --dev mode which enables both.
CORS Errors
Error: Browser blocked by CORS policy
Access to fetch has been blocked by CORS policy: No 'Access-Control-Allow-Origin' headerFix: Configure CORS using the correct schema for your Router version:
v1 (flat schema):
cors:
origins:
- http://localhost:3000
- https://studio.apollographql.com
allow_headers:
- Content-Type
- Authorizationv2 (policies schema):
cors:
max_age: 24h
policies:
- origins:
- http://localhost:3000
- https://studio.apollographql.com
allow_headers:
- Content-Type
- AuthorizationFor development (not production):
# v1
cors:
origins:
- "*"
# v2
cors:
allow_any_origin: trueCORS config ignored after upgrading to v2:
If you upgraded from v1 to v2 and your CORS settings stopped working, you're
likely using the v1 flat schema (cors.origins). v2 requires the policies
array format (cors.policies). See the divergence map
for the full diff. You can auto-migrate with: router config upgrade router.yaml
JWT Issuer Field Mismatch (v2)
If you migrated from v1 to v2 and kept the singular issuer field instead
of the plural issuers array, the config uses a v1-only field. Use issuers
for Router v2.
Broken (v1 field in v2 config):
authentication:
router:
jwt:
jwks:
- url: https://auth.example.com/.well-known/jwks.json
issuer: https://auth.example.com/ # WRONG for v2!Fixed (v2 field):
authentication:
router:
jwt:
jwks:
- url: https://auth.example.com/.well-known/jwks.json
issuers: # Correct for v2
- https://auth.example.com/Performance Issues
Slow Queries
Debug steps:
- Enable query plan logs:
telemetry:
exporters:
logging:
stdout:
enabled: true
format: jsonCheck subgraph latency: Enable tracing to identify slow subgraphs.
Enable caching:
supergraph:
query_planning:
cache:
in_memory:
limit: 512High Memory Usage
- Limit cache sizes:
supergraph:
query_planning:
cache:
in_memory:
limit: 256 # Reduce from default- Check for complex queries that generate large query plans.
Response Cache Misses
- Check subgraph Cache-Control headers: origin must return
Cache-Controlwithoutno-store - Verify Cache-Control headers: subgraph responses need
Cache-Control: max-age=N(via@cacheControlin Apollo Server, or set directly in other frameworks) - Check scope:
Cache-Control: privaterequiresprivate_idto be configured on the router - Verify Redis connectivity: check
apollo.router.cache.redis.errorsmetric - Enable cache debugger (dev only): set
response_cache.debug: trueand use Apollo Sandbox to inspect cache state
Federation Issues
Composition Errors at Runtime
Router logs composition errors:
Error: Subgraph schema validation failedFix: Validate schema before deploying:
rover subgraph check my-graph@production \
--name products \
--schema ./schema.graphqlEntity Resolution Failures
Error: Cannot resolve entity
{
"errors": [{ "message": "cannot resolve entity of type User" }]
}Checklist:
- Subgraph implements
_entitiesquery - Entity's
@keyfields match between subgraphs - Reference resolver returns correct data format
Health Check
Check Router health on the configured health listener (the provided templates use 127.0.0.1:8088/health):
curl http://localhost:8088/healthExpected response:
{"status":"healthy"}If you are not using an explicit health_check config, Router also exposes:
curl http://localhost:4000/.well-known/apollo/server-healthFor Kubernetes readiness probe (matching this skill's templates):
readinessProbe:
httpGet:
path: /health
port: 8088
initialDelaySeconds: 5
periodSeconds: 10Debug Mode
Get more verbose output:
APOLLO_ROUTER_LOG=debug router --supergraph ./supergraph.graphqlLog levels:
error- Errors onlywarn- Warnings and errorsinfo- General information (default)debug- Detailed debug informationtrace- Very verbose tracing
Common Mistakes
| Mistake | Solution |
|---|---|
| Introspection disabled in dev | Use --dev flag |
| Wrong subgraph URL in production | Use override_subgraph_url |
| CORS not configured | Add allowed origins |
| Timeout too short | Increase traffic_shaping.timeout |
| Missing APOLLO_KEY | Set environment variable |
| Wrong graph ref format | Use graph-id@variant |
Getting Help
- Check Router documentation
- Search Apollo Community
- Check GitHub Issues
- Enable debug logging for detailed error information