So, here’s my stack:
Customers subgraph running on Django, python, graphene-federation.
- Has a CustomerType that is linked to a Customer model
Sprints subgraph running on Django, python, graphene-federation.
- Has a SprintType that is linked to a Sprint model
- The SprintType has a field called “customer” that holds a UUID to a Customer in the Customers service.
My question is:
How would I make sure that the “customer” field in the SprintType is being resolved within the Customers subgraph?
Here’s the query I am trying to run:
query Query {
allSprints {
customer {
id
name
}
}
}
Here’s the error code:
{
"data": {
"allSprints": [
{
"customer": null
}
]
},
"errors": [
{
"message": "Cannot return null for non-nullable field CustomerType.name.",
"path": [
"allSprints",
0,
"customer",
"name"
],
"extensions": {
"serviceName": "customers",
"code": "DOWNSTREAM_SERVICE_ERROR",
"stacktrace": [
"GraphQLError: Cannot return null for non-nullable field CustomerType.name.",
" at Object.err (D:\\Tailored Software\\Sprints\\5-2023\\Repos\\graphql-server-example\\node_modules\\@apollo\\federation-internals\\dist\\error.js:11:32)",
" at downstreamServiceError (D:\\Tailored Software\\Sprints\\5-2023\\Repos\\graphql-server-example\\node_modules\\@apollo\\gateway\\dist\\executeQueryPlan.js:585:120)",
" at D:\\Tailored Software\\Sprints\\5-2023\\Repos\\graphql-server-example\\node_modules\\@apollo\\gateway\\dist\\executeQueryPlan.js:309:59",
" at Array.map (<anonymous>)",
" at sendOperation (D:\\Tailored Software\\Sprints\\5-2023\\Repos\\graphql-server-example\\node_modules\\@apollo\\gateway\\dist\\executeQueryPlan.js:309:44)",
" at processTicksAndRejections (node:internal/process/task_queues:96:5)",
" at async D:\\Tailored Software\\Sprints\\5-2023\\Repos\\graphql-server-example\\node_modules\\@apollo\\gateway\\dist\\executeQueryPlan.js:256:49",
" at async executeNode (D:\\Tailored Software\\Sprints\\5-2023\\Repos\\graphql-server-example\\node_modules\\@apollo\\gateway\\dist\\executeQueryPlan.js:180:17)",
" at async executeNode (D:\\Tailored Software\\Sprints\\5-2023\\Repos\\graphql-server-example\\node_modules\\@apollo\\gateway\\dist\\executeQueryPlan.js:171:27)",
" at async executeNode (D:\\Tailored Software\\Sprints\\5-2023\\Repos\\graphql-server-example\\node_modules\\@apollo\\gateway\\dist\\executeQueryPlan.js:154:40)"
]
}
}
]
}