Skip to content

StreamInOut silently ignores invalid RequestInterface messages #2158

@nickpokhilko

Description

@nickpokhilko

Hi there!

When using

api.streamInOut<RequestInterface, ResponseInterface>(...)

there is an issue with how incoming messages are handled.
If the client sends a message that does not fully match the declared RequestInterface, it never reaches the polling loop:

for await (const message of this.#stream) {
  ...
}

For example, given:

interface RequestInterface {
  prop1: string;
  prop2: string;
}

and the client sends:

await stream.send({ prop1: "test" });

the message is successfully sent to the socket, but Encore silently ignores it. No warnings or errors are triggered, making the issue hard to debug.
This results in the server never receiving the message in the stream loop, even though it was transmitted.

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