arraySubscription publishes the wrong root field and returns null events
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 113
- Forks
- 22
- Avg merge
- 10h 40m
- Merged PRs (30d)
- 13
Description
Environment
Unraid OS Version: 7.3.2
Are you using a reverse proxy? No. Reproduced directly against the Unraid GraphQL API.
Pre-submission Checklist
- I have verified that my Unraid OS is up to date
- I have tested this issue by accessing my server directly (not through a reverse proxy)
- This is not an Unraid Connect related issue
Issue Description
The arraySubscription GraphQL subscription fails when an array update is emitted because the event publisher sends the payload under array, while GraphQL resolves the subscription root field named arraySubscription.
Latest main at reproduction: 12c23d808a45e8521ded6d36bdf0c0aaf152775a.
The resolver subscribes to the array channel:
api/src/unraid-api/graph/resolvers/array/array.resolver.ts
@Subscription(() => UnraidArray)
public async arraySubscription() {
return createSubscription(PUBSUB_CHANNEL.ARRAY);
}
The publisher emits a differently named root property:
api/src/store/listeners/array-event-listener.ts
pubsub.publish(PUBSUB_CHANNEL.ARRAY, { array });
Other working subscriptions publish an object keyed by the GraphQL subscription field, for example { systemMetricsCpu: payload } and { dockerContainerStats: stats }.
Steps to Reproduce
- Subscribe directly to:
subscription { arraySubscription { id state } } - Trigger an array state update that causes the disks state file listener to publish.
- Observe the GraphQL subscription error.
Expected Behavior
The subscription emits a non-null UnraidArray payload under arraySubscription.
Actual Behavior
The live API returns:
Cannot return null for non-nullable field Subscription.arraySubscription.
The regular array query succeeds, confirming the underlying array object is valid.
Additional Context
The relevant publisher and resolver files are unchanged between deployed API release commit f3205d978fada931da54df4255d41c07489066d9 and latest main commit 12c23d808a45e8521ded6d36bdf0c0aaf152775a.
There is currently no integration test that publishes an array event and executes the GraphQL subscription end to end.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with api/src/unraid-api/graph/resolvers/array/array.resolver.ts and api/src/store/listeners/array-event-listener.ts, then compare the payload keys used by the working subscriptions. Run the direct GraphQL subscription reproduction while triggering an array state update. Done means arraySubscription emits a non-null UnraidArray payload and an integration test covers the publish-and-subscribe path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- api, backend-api-design, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100