Skip to content

arraySubscription publishes the wrong root field and returns null events #2056

Description

@jmagar

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

  1. Subscribe directly to:
    subscription { arraySubscription { id state } }
  2. Trigger an array state update that causes the disks state file listener to publish.
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions