Skip to content

Fix realtime-js: decode edge cases#2130

Open
yukimotochern wants to merge 3 commits intosupabase:masterfrom
yukimotochern:fix/realtime-js-decode
Open

Fix realtime-js: decode edge cases#2130
yukimotochern wants to merge 3 commits intosupabase:masterfrom
yukimotochern:fix/realtime-js-decode

Conversation

@yukimotochern
Copy link

@yukimotochern yukimotochern commented Feb 23, 2026

🔍 Description

What changed?

Why was this change needed?

Closes #(issue_number)

📸 Screenshots/Examples

🔄 Breaking changes

  • This PR contains no breaking changes

📋 Checklist

  • I have read the Contributing Guidelines
  • My PR title follows the conventional commit format: <type>(<scope>): <description>
  • I have run npx nx format to ensure consistent code formatting
  • I have added tests for new functionality (if applicable)
  • I have updated documentation (if applicable)

📝 Additional notes

@yukimotochern yukimotochern requested review from a team as code owners February 23, 2026 06:36
@yukimotochern yukimotochern marked this pull request as draft February 23, 2026 06:36
@coderabbitai
Copy link

coderabbitai bot commented Feb 23, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Improved handling of malformed real-time messages to prevent potential crashes and enhance system stability.

Walkthrough

The Serializer.decode method's string-handling branch now wraps JSON.parse(rawPayload) in a try/catch and validates the parsed value. If parsing throws, it logs "Error parsing Realtime message" and returns an empty object via callback. If parsing succeeds but the result is not an array with at least five elements, it logs "Malformed Realtime message" and returns an empty object via callback. Non-string handling remains unchanged.


Comment @coderabbitai help to get the list of available commands and usage tips.

@yukimotochern
Copy link
Author

I typically use zod in my own project for validation but not sure the dependency policy here.

@yukimotochern yukimotochern marked this pull request as ready for review February 23, 2026 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants