Component(s)
router
Component version
0.286.0
wgc version
0.105.4
controlplane version
cloud
router version
0.286.0
What happened?
Problem Summary
When a gRPC entity lookup returns a null optional message field, the Router incorrectly attempts to resolve nested field resolvers on that null field, causing "expected array or object, got null" errors.
Root Cause
The gRPC datasource planner's response assembly logic doesn't validate parent field existence before attempting field resolution. The LookupMapping structure defines field resolver configurations , but lacks null checks for parent fields.
Technical Details
Field Resolver Processing:
The router processes ResolveMappings to create separate gRPC calls factoryresolver.go:678-742 , but doesn't check if parent fields are null before making these calls.
Missing Null Validation:
No evidence in the codebase of null checks before attempting field resolution on optional message fields.
Reproduction Scenario
Entity User has optional field avatarFile: StorageFileVersion
avatarFile is null/absent in gRPC response
avatarFile has nested field resolver accessUrl
Router calls resolveStorageFileVersionAccessUrl with empty context
Response assembly fails with "expected array or object, got null"
Error Trace
{
"output": {
"errors": [
{
"message": "expected array or object, got null",
"extensions": { "code": "Internal" }
}
]
}
}
Expected Behavior
Router should skip field resolver calls when parent fields are null/absent, avoiding unnecessary gRPC calls and response assembly failures.
Fix Location
The fix requires adding null checks in the gRPC datasource planner's response assembly logic within github.com/wundergraph/graphql-go-tools/v2 before attempting field resolution.
Environment information
Environment
OS: (e.g., "Debian")
Package Manager: pnpm
Compiler(if manually compiled): "go 1.25"
Component(s)
router
Component version
0.286.0
wgc version
0.105.4
controlplane version
cloud
router version
0.286.0
What happened?
Problem Summary
When a gRPC entity lookup returns a null optional message field, the Router incorrectly attempts to resolve nested field resolvers on that null field, causing "expected array or object, got null" errors.
Root Cause
The gRPC datasource planner's response assembly logic doesn't validate parent field existence before attempting field resolution. The LookupMapping structure defines field resolver configurations , but lacks null checks for parent fields.
Technical Details
Field Resolver Processing:
The router processes ResolveMappings to create separate gRPC calls factoryresolver.go:678-742 , but doesn't check if parent fields are null before making these calls.
Missing Null Validation:
No evidence in the codebase of null checks before attempting field resolution on optional message fields.
Reproduction Scenario
Entity User has optional field avatarFile: StorageFileVersion
avatarFile is null/absent in gRPC response
avatarFile has nested field resolver accessUrl
Router calls resolveStorageFileVersionAccessUrl with empty context
Response assembly fails with "expected array or object, got null"
Error Trace
Expected Behavior
Router should skip field resolver calls when parent fields are null/absent, avoiding unnecessary gRPC calls and response assembly failures.
Fix Location
The fix requires adding null checks in the gRPC datasource planner's response assembly logic within github.com/wundergraph/graphql-go-tools/v2 before attempting field resolution.
Environment information
Environment
OS: (e.g., "Debian")
Package Manager: pnpm
Compiler(if manually compiled): "go 1.25"