graphql-sse: Cannot call write after a stream was destroyed

Screenshot image

Expected Behaviour Do not write to the stream after it is closed / destroyed

Actual Behaviour Writes to stream after it was destroyed which results in an error.

Debug Information This bug resulted when using the use/express handler created with a createHandler call. According to the code there is no check in place wether the stream was closed in the meantime.

Further Information Maybe introduce a variable let cancelled = false; and set it to true once the stream was closed. Check for cancelled before trying to do a .write().

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 17 (12 by maintainers)

Commits related to this issue

Most upvoted comments

@michelalbers, @groundmuffin the v2.2.2 includes a fix, would be great if you can test it out and report if the issue persists. Thank you for reporting and advising!