[PR #30131] fix(web): add null check for SSE stream bufferObj to prevent TypeError #32699

Closed
opened 2026-02-21 20:51:54 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/30131

State: closed
Merged: Yes


Summary

  • Added null/type validation for bufferObj after JSON.parse in handleStream function
  • Prevents TypeError when server returns null or non-object data in SSE stream
  • Added comprehensive test coverage for the fix

Test plan

  • Added unit tests for null bufferObj handling
  • Added unit tests for non-object bufferObj handling
  • Added unit tests for valid message event handling
  • Added unit tests for error status 400 handling
  • Added unit tests for malformed JSON handling
  • All new tests pass locally

fixes #29166

**Original Pull Request:** https://github.com/langgenius/dify/pull/30131 **State:** closed **Merged:** Yes --- ## Summary - Added null/type validation for `bufferObj` after JSON.parse in `handleStream` function - Prevents TypeError when server returns `null` or non-object data in SSE stream - Added comprehensive test coverage for the fix ## Test plan - [x] Added unit tests for null bufferObj handling - [x] Added unit tests for non-object bufferObj handling - [x] Added unit tests for valid message event handling - [x] Added unit tests for error status 400 handling - [x] Added unit tests for malformed JSON handling - [x] All new tests pass locally fixes #29166
yindo added the pull-request label 2026-02-21 20:51:54 -05:00
yindo closed this issue 2026-02-21 20:51:54 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#32699