Skip to content

[relay-compiler 13] Invalid use of @stream on scalar field #3755

Open

Description

@artola

With v13 (even on @main) I get error when using @stream on a List of scalars, while it works for objects.
Is this defined somewhere in the spec? It is not clear to me (spec for @stream) , just the field must be List type. The data in payload could be any scalar too.

type Query {
  alphabet: [String!]
}
alphabet: {
  type: new GraphQLList(new GraphQLNonNull(GraphQLString)),
  resolve: async function* () {
    for (let letter = 65; letter <= 90; letter += await bumpy(1)) {
      yield String.fromCharCode(letter);
    }
  },
},
query demo3Query {
  alphabet @stream(initial_count: 3)   // <== [ERROR] ✖︎ Invalid use of @stream on scalar field 'alphabet'
}

Note: the test is correct for such case, but it does not cover the above mentioned case but it is pretty much similar, just a different query field.

The above example works for this kind of query:

query demo3Query {
  alphabet @stream(initial_count: 3) {
    char
  }
}

Activity

  1. AlicanC commented on Jun 15, 2026

    @AlicanC
    Contributor

    I've published a PR to add support for this: #5321

    I was using the RelayIncrementalDeliveryTransformer from https://github.com/robrichard/defer-relay-example which required some modifications.

    Modified RelayIncrementalDeliveryTransformer: https://gist.github.com/AlicanC/3d793467a545458d0aff61728b2507fd

    Edit: Realized the modified transformer has some other issues. Might fix some time, might not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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